I have a source audio with this code:
public class Sound : MonoBehaviour {
Static Sound instance;
void Awake()
{
if (instance != null)
{
Destroy(gameObject);
}
else
{
instance = this;
DontDestroyOnLoad(gameObject);
}
}
So when i change scenes the audio starts playing again. How do i limit it to having only 1?
Edit: How do i fix that? i get this error
1 - Unexpected symbol instance' in class, struct, or interface member declaration 2 - Unexpected symbol ;' in class, struct, or interface member declaration