Hello,
I have a GameObject with AudioSource and script which have this piece of code:
void Awake () {
if (!instance) {
instance = this;
} else {
Destroy (this.gameObject);
}
DontDestroyOnLoad (this.gameObject);
}
I have also other methods, and main purpouse of this gameobject is to hold clips and play it by calling methods. When I add this GameObject to my Button OnClick() it works fine, but if I restart scene then there is no that GameObject assigned to Button OnCLick(), it says: Missing (Object).
Why is this happening?