0 votes

HI
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.

asked Mar 3 in Projects by unlasting (26 points)

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

1 Answer

0 votes
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.

answered Mar 3 by njamster (8,874 points)
selected Mar 4 by unlasting

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 How to use this Q&A? before posting your first questions.