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

Don'tDestroyonLoad only work for root Objects Warning

$
0
0
Don'tDestroyonLoad only work for root Objects Warning created so many times when i run my project. i use this singleton script public class Singleton : MonoBehaviour where T : MonoBehaviour { private static T instance; public static T Instance { get { if (instance == null) instance = FindObjectOfType(); else if (instance != FindObjectOfType()) Destroy(FindObjectOfType()); DontDestroyOnLoad(FindObjectOfType()); return instance; } } } and use it on my two other scripts , GameManager and TowerManager I put these scripts into my main camera what cause that warning and how to fix this warning.

Viewing all articles
Browse latest Browse all 416

Trending Articles



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