Hello, I have a question regarding the declaration of variables in External Events.
If I have an External Event (for example, TEST1) associated with a scene (for example, SCENE1), and I call it from different scenes (from SCENE2, SCENE3, etc.), are the scene variables of SCENE1 that TEST1 temporarily assigns recognized by the other scenes or not?
I conducted a test. It only works if the other scenes (SCENE2, SCENE3, etc.) also have the same variable declared (so it needs to be declared in each scene).
Clarifications or further insights from you are still appreciated!
Scene variables only work in the scene they’re created. Global variables can be accessed from any scene but would use the same value.
You could use a global structure variable if you wanted a different value related to each scene. You could use the CurrentSceneName() as a child name.
Like
Score[CurrentSceneName()]
You could also check the current scene name in a condition in an external event and do different things based on the CurrentSceneName()] You would probably need to use compare 2 strings. Scene name versus text.
1 Like
Hello, and thank you for your response. Clearly, in these cases, I always use global variables. However, some extensions create Scene Variables, and since I use them in External Events shared across multiple scenes, I started wondering about it.
Anyway, it’s enough to declare the same scene variables and then copy those values into global variables!
1 Like