How should I reset my game between each try ?


I wonder how I should reset my game when my player die.
Can I just reload the scene, to reset all gameobject easily ?
I can’t just Tp my player to the beggining of the parkour because my game is a verticale Plateformer with a random parkour. So in my opinion the best option would be to reload the scene to restart.
But is there any undesirable effect to that option ? Anything I should know ?
It’s quiet an important part of my game to restart it fast and I need to restart it every 2 to 5 minutes.
I can reset my LevelManager, my BackGround Manager and my GameManager and tp my player, would it be a better option ?
The game is meant to be played on a phone, so I would like to have something a minimum optimize. =)

Use Namespace using UnityEngine.scenemanagement and in your code SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); to reload the scene. Reloading the scene will set it to the state it was last saved as. So it should work fine, to my knowledge the main drawback of this method is any saved data you may want.

Perhaps there are enemies you kill that you don’t want to kill again, or items you picked up you don’t want to have to pick up again.

But if the goal of the level is simply to get from A to B with the same system each time. Loading the level should be fine.

Just have another question for you guys, I used DontDestoyOnLoad(gameObject) to save my AudioManager, like that the music won’t restart every time, but how should I do to make sure that a new AudioManager won’t reload in the new scene ? Because if I keep it like that, I have 2 AudioManager and 2 times the same music, unsync of course, and it’s a bit annoying, I think you’ll agree with me =)

I would recommend to split the scenes.
You can have a basic scene with one audio manager, which loads your game scene additionally.
Then you just unload and reload the game scene.
That way, the basic scene stays as is.