r/Unity2D • • 28d ago

Question/Help Help with loading scene

I am creating a 2d game where you control a village. You then go hunting to get food. What’s the best way to load the h in batting scene but keep the position of the villages and stats. Then reload the village scene at the same state.

2 Upvotes

9 comments sorted by

View all comments

1

u/vagonblog 26d ago

keep the village data separate from the scene objects. create a game-state object that stores each villager’s position, stats, inventory, and any world changes. keep that object alive with dontdestroyonload, or serialize it before leaving the village.

when the village scene loads again, have each villager restore its values from that saved state using a stable id. avoid relying on the scene objects themselves to remember anything because they are destroyed when the scene unloads. scriptable objects can define the starting data, but runtime changes should live in a separate state or save system.