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.
↧