Hello, I have an object with this script applied to it:
var DestroyOnLoad : boolean = false;
function Awake () {
if(!DestroyOnLoad){
DontDestroyOnLoad(transform.gameObject);
}
}
The variable DestroyOnLoad is set to false. The script works! The problem is that when I load another level, and then go back to the original level, there are now two of the same objects in the scene. I could then leave and come back as many times as I want, and each time another duplicate would appear. This is a serious problem because the object is an audio source, so the music starts to overlap. How do I fix this?