Hey,
I want to play some music in my game but I can’t get it to play, I already attached the script to a game object that I placed inside the scene. this is my code:
static MusicPlayer instance = null;
void Awake()
{
if (instance != null)
{
Destroy(gameObject);
}
else
{
instance = this;
GetComponent<AudioSource>().Play();
DontDestroyOnLoad(gameObject);
}
}
Thanks in advance.