0 votes

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?


in Engine by (53 points)

2 Answers

0 votes

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.

by (1,488 points)

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

0 votes

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.

by (805 points)

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

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.