having data move from one scene to another

I want to be able to keep the data the same between scenes, so like for example, if my health was at 50% and i were to switch scenes, the health would stay 50% instead of resetting back to 100%.

To achieve this, two approaches come to mind:

  • implement your systems in separate scenes that are open at the same time, and only unload/load the level scene while keeping the UI and health-management-scene alive
  • use DontDestroyOnLoad on your GameManager that keeps score of the health, which would basically be the same thing as option A but a bit easier to use.
1 Like