[Solved] Object variable of global object changes in different scenes

Hi there.
I have a global object that I use in two scenes.

It has an object Integer variable assigned to it, which is called Level.

When I set the ‘Level’ variable value in one scene, it doesn’t set it in the other scene where the global object exists.
Also when I come back to the first scene the object variable ‘Level’ resets itself to the initial value, not the one I set it to and left it when I changed scenes.

Is there a way to permanently change object variables of global variables throughout all scenes and even while changing scenes?

Although the instances are generated from the same object, thay are very different. Each scene will be creating a new version of the object, and along with that a new instance of the variable. These instances whare the same traits (animations, behaviours, variables names and initial variable values), and changing one of these default object attributes will change it for each instance as it gets created. Think of them as a template.

You’d be best to store the value in a global variable. If it must be a value of hte object, then assign the global variable value to the object instance variable at the start of the scene, and store the instance variable value inthe global variable just before the scene is exited.

1 Like

Hi MrMen.
Thank you for the explanation.
Yes that’s basiclly what I did, using global variables.
I was just wondering if there is a way to actually change the object variables themselves permanently.
Now it’s clear


1 Like