DonotDistroyOnLoad in unity 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)
}
}