How to access variables in another scene

I've seen multiple of solutions regarding this but mostly it requires switching to another scene.. Is there any way to access variables in another scene without having to involve switching scenes? Thanks in advance

You can't, but you can do a similar way by sending data from broadcasts, especially continuing.

untitled script pic (4)

Actually I'm creating something which involves multiple users such as admin and player.. It's kinda impossible to make the player switch to the admin's scene or vice versa. Hmm... do you have any other suggestion for this case? Thanks.

I don't think there's a way for this, because each scene has its own data, and other scenes cannot access one.

Ooo... Alright thanks!

Sounds to me like you don't really want the player to be able to ask for arbitrary variables of the admin. What you want is for the admin to publish only the specific things the player should be able to access. So I guess you could do


and then the admin scene's SEND-PLAYER method could reply to scene PLAYER (that's why the player has to include its name in the message it sends) with an ADMIN-DATA message with the value; so the player would have a script starting with
admin script pic (1)
to do something with the value. ADMIN would only accept certain requests, such as SCORE.

Sorry but I've already made some adjustments to my project and have now resolved to using the normal switch to scene block without involving any data/variable. With this said, I didn't really use any of the solutions both of you provided, so I can't mark any of them as the solution. Should I flag to delete the post, or just leave it as it is? Thanks for the help anyways!

I've been trying to figure out how you could send a group of variables to a scene and you just said this.
lol

Sorry for that lol but still thanks though for the attempt to help

I figured it out, just now. By getting all the variables of a Sprite, with their name and value, and turning it into a JSON string, then separating it in the next scene.

By doing this, I might've disproved that

To make this simpler, drag this into your project.
ToMakeItSimple

Leave it as is, as it can still provide some help for other people.

Alright, thanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.