|Topic was automatically imported from the old Question2Answer platform.
I have created a C# Scene to make an advanced LineEdit node, along with a script with [ExportAttribute] variables. These variables show up in the editor.
In my main game I need a few of these LineEdit scenes. Everything seems to work great when I instance 1 scene. However, when I instance more of the same scene, my problem begins.
Whatever Script variable I set in one instance, AT RUNTIME, the rest of the scenes copy that Script variable.
For instance, one Script Variable is:
[ExportAttribute] bool onlyNumbers = false;
This variable is checked to see if the LineEdit in the instanced scene should only allow numbers to be typed.
In my main project I create 3 instanced scenes. Inside the editor, I can set
onlyNumbers script variable to true on one, and false on the 2 others. However, when I run the game, they all set to true.
How do I make the script variables unique for each instance?
I’d make sure you are making individual instances of the scene instead of creating pointers that just point to that same scene. Do you have code for how you’re instantiating these at runtime?
bulbasaur | 2020-05-10 20:48