Quantcast
Channel: Questions in topic: "dontdestroyonload"
Viewing all articles
Browse latest Browse all 416

DontDestroyOnLoad duplicate prevention code is deleting the original player

$
0
0
Still working on a 2D overhead game. So now I realized that the script I am using for DontDestroyOnLoad is deleting the original player that I am using. DontDestroyOnLoad(transform.gameObject); if (GameObject.Find(gameObject.name) && GameObject.Find(gameObject.name) != this.gameObject) { Destroy(GameObject.Find(gameObject.name)); } This is the code that I am currently using to delete duplicates, but when loading back to the original scene, it deletes the original and messes up the whole rest of the code, such as the start points I am using. Does anyone know how to fix this?

Viewing all articles
Browse latest Browse all 416

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>