- Home /
AudioSource playing when changing Scenes?
Greetings,
I have a gameobject with an audiosource, the audioclip keeps playing when I change to other scenes, however when i reload the initial scene it restarts the songss...
I tried this:
public class OnryOne : MonoBehaviour {
private static OnryOne instance = null;
public static OnryOne Instance {
get { return instance; }
}
void Awake() {
if (instance != null && instance != this) {
Destroy(this.gameObject);
return;
} else {
instance = this;
}
DontDestroyOnLoad(this.gameObject);
}
}
However what this does, is that it gives me a bunch of MissingReferenceExceptions...each frame... Why? Any ideas how to solve something like this?
Comment
Why am I even getting that many missingreferenceexpections if I only have the awake function...?
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Multiple Cars not working 1 Answer
Mouse and Oculus Touch Controller Inputs 0 Answers
How to move the other object without moving the first object? 1 Answer