Am not quiet sure what exactly is the issue in my code below. Am not able to save the game object with its component between the scene. I have created the singleton and dont destroy on load.
Problem: Once I get back to the scene all the buttons and other components are not working at all. Is there any issue with my code?
private static startScreen_Manager _startScreen_ManagerInstance;
public static startScreen_Manager startScreen_ManagerInstance
{
get
{
if(_startScreen_ManagerInstance == null)
{
_startScreen_ManagerInstance = GameObject.FindObjectOfType();
DontDestroyOnLoad(_startScreen_ManagerInstance.gameObject); // Unity dont delete this object on level load.
}
return _startScreen_ManagerInstance;
}
}
void Awake()
{
if(_startScreen_ManagerInstance == null)
{
_startScreen_ManagerInstance = this;
DontDestroyOnLoad(this);
}
else
{
if(this != _startScreen_ManagerInstance )
{
Destroy(this.gameObject);
}
}
}
↧