The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

I have no idea about how to persist the object state in scene (not saving) when the scene is changed.

for example, the situation which I want to implement.

  1. at level1 initial state, >> there is only a player in level1.
  2. then, player plants a tree >> instance a tree in level1.
  3. player move to level2
  4. player comes back to level1 >> the tree is still in level1
  5. if player quite the game (without saving) and re-open it again >> go to level1 initial state, which doesn't have any tree

Thank you for your help.

in Engine by (28 points)

Read the point 3 in chapter Change scenes manually and see if that works for you.

1 Answer

+1 vote
Best answer

You could store the changes to a temporary savefile that you delete once the player exits the game - or copy into the regular savefile, when the player saves manually.

Click here for an introduction on how to save games in Godot.

While setting this stuff up can be a lot of work, I'd argue it's worth the effort, especially when your game gets bigger and memory use becomes a more important factor. It's also worth pointing out that this gives you a lot of control about what to load and when.

by (10,634 points)
selected by

thank you for your answer sir.

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.