Audio To Continue when Restart the Scene

  • I have a scene named “Main” which has a Game Object named “Audio Manager”.
  • “Audio Manager” has the component Audio Source attached to it, which has an Audio Clip assigned, and the Loop is ON.
  • When I restart the same scene, the Audio Manager plays the Audio Clip from the start. I use the following line of code to restart the scene:
  • SceneManager.LoadScene(this.gameObject.scene.buildIndex);
  • I want to continue the Audio Manager to play the Audio Clip without starting from the start.

  • I tried to search on the web for an answer and I found that we can use DontDestroyOnLoad().

  • But the problem is that the Audio Manager is still present in the Scene. This way, there will be two Audio Managers playing the Music, one from the start, and one just continuing where it was the last time.

- Thank You for your Time :slight_smile:

maybe this video will help: