need help with exported array

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By torohaifisch

Hello everyone!

i have a scene with an exported array with default values, the problem is that if i instance that scene and change the values of the array using the editor, it shows them changed but when i execute the game the instanced scene is loading the array with the original values.
can anyone explain why is this happening and if it is an expected behavior?


:bust_in_silhouette: Reply From: MysteryGM

can anyone explain why is this happening and if it is an expected behavior?

It is the expected behavior, the values set in the editor should overwrite all other values.
This way you will always have constant new game no matter what is changed. Think of the editor values as the default values.

You need a loader function that changes variables after startup, for your variables to change.
For example if one of the variables is “soundVolume” then it has a backup default value from the editor, but on startup it will load the value from the “playerPreferences” list.

but this doesnt work like that if u export a vector3 and set default values in the original instance and then create 2 instances with different values they will have the new values and not the default ones

torohaifisch | 2018-10-04 22:16

:bust_in_silhouette: Reply From: wyattb

This makes sense because you don’t want changes to mess up your saved scenes while running. Think of it as debugging. It is temporary and when you restart it resets everything.

Actually there may be a warning the editor will not save the changed values while your app is running. So, you need to stop your code and change the values to what you want if you want it to be permanent.

i meant i am not changing the value when the app runs i change it before as it lets it to be changed before running using the editor, the original scene has the array with default values and then i instance it in another scene and change those values there

torohaifisch | 2018-10-02 21:23