unity get object from dontdestroyonload code example
Example: unity dontdestroyonload
private void Awake(){
if(instance == null){
instance = this;
DontDestroyOnLoad(instance);
}
else{
Destroy(gameObject)
}
}
private void Awake(){
if(instance == null){
instance = this;
DontDestroyOnLoad(instance);
}
else{
Destroy(gameObject)
}
}