Good morning, I’m developing a mobile game right now. I want to find a GameObject with Gameobject.Find() but nothing is found, but I have the object on which the script hangs with another script linked where Dont destroy on Load is untitled. see below.
Thanks in advance
//Other Code
void Start()
{
DontDestroyOnload1();
}
public void DontDestroyOnload1()
{
DontDestroyOnLoad(gameObject);
if(instance == null)
{
instance = this;
}
else
{
Destroy(gameObject);
}
}
//Script whit.Find
void Update()
{
Level4Buttons();
}
public void Level4Buttons()
{
if (LevelSlectionsMenu == 1)
{
if (getNext.WhichLevel >= 4)
{
Level4ButtonIsDeaktivated = GameObject.Find("Cube");
Level4ButtonIsDeaktivated.SetActive(true);
Debug.Log("You can Play LV.4");
}
else
{
{
Level4Button = GameObject.Find("Level4-Button");
Level4Button.SetActive(false);
Debug.Log("You didn´t can play LV.4");
}
}
}
}
