I’ve just watched and carried out the work on the BlockBreaker scrip to make the music play once at the beginning…
I’ve checked that my code is the same as the screen grabs etc.
HOWEVER - the music is stopped after the first ‘blip’ of the tune.
The menu cycles through correctly, the log counts up - indeed showing that the music is killed straight away…
WHY??
using UnityEngine;
using System.Collections;
public class MusicPlayer : MonoBehaviour {
static MusicPlayer instance = null;
// Use this for initialization
void Start () {
if (instance != null) {
Destroy (gameObject);
print ("Duplicate music player self-destructing");
} else {
instance = this;
GameObject.DontDestroyOnLoad(gameObject);
}
}
// Update is called once per frame
void Update () {
}
}