How can I change scenes in Unity while maintaining the current characteristics and values of my player?

Asked

Viewed 185 times

1

Good afternoon. I have a project at Unity in C# to practice here, and I have the following difficulty: My player will have some bool variables and an inventory of items that I need to keep when switching scenes. What’s the best way to do that? Like, I need the player to be literally "transferred" to the other scene, just like he was in the previous scene. I can’t just instantiate player Prefab as it was when it was created. Thank you.

  • Use this, it will not destroy itself when you change scenes https://docs.unity3d.com/ScriptReference/Object.DontDestroyOnLoad.html

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.