void Start () {
if(instance !=null){
Destroy(gameObject);
print ("dup destroyed");
}else{
instance=this;
GameObject.DontDestroyOnLoad(gameObject);
}
}
In the line with Destroy, If the program enters that part of the if statement then there are two gameObjects. How does the compiler know which game object to destroy?