|Topic was automatically imported from the old Question2Answer platform.
guys i have a node with a variable = 0 and its instance is made unique (any changes dont affect other instances) with the variable =1 and i called it from another script using the variable but instead of using the unique instance variable(=1) it uses the main node variable (=0) so how do i make it use the unique variable (=1)
Maybe You are mixing thing up
When You save a node as a .tscn file it is a shared blueprint for your instances. All nodes created from this scene using
instance()become unique, but start with the base variable You introduced in the blueprint. If You want instances to have unique values, You have to set them by code or introduce variables as
export and save instances as another scene.
Or do You mean You try to set value by code, but it gets back to 0 ?
If so, then make sure, if your variable is not set to 0 AFTER You set it to 1
for example if You set it to 1 in
init(), but class scene changes sets it to 0 in
I am gonna add more details to the question so i have a door that when i touch i go to next level and to know which level i am in i added a variable calle (current level) and i exported it and in each level i modify its value to the level number and in code i made it so if the player touches the door it changes scene to (current level)+1 it works fine but now i want to save the players progress so in the save function it saves the (current level) value into a cfg file and it worked but instead of saving the exported value that i modify it saves the original value which in code is 0
moazdeyaa | 2022-12-17 17:08