So, i want play music all time. when the scene is reloaded, the music starts from the beginning, but I want it to continue from the same moment using UnityEngine;
public class MusicBack : MonoBehaviour
{
private void Awake()
{
GameObject[] objs = GameObject.FindGameObjectsWithTag("Music");
if (objs.Length > 1)
{
Destroy(gameObject);
}
DontDestroyOnLoad(gameObject);
Debug.Log("correct");
}
}
CodePudding user response:
I think that you'll need a custom script, like suggested here: