Hello there, i’ve have a problem here, im trying to make a condition where my GameObject will find a specific gameobject with tag and ignore finding any gameobject it the gameobject with tag does not exist in the enviroment, I understand how to find the game object on start i just make a simple script
public GameObject time;
void Awake ()
{
if (time == null)
{
time = GameObject.FindWithTag ("gameManager");
}
}
now how do i make it ignore finding the gameobject with tag if its not in the enviroment, because I tried it like this it wont work
public GameObject time;
// Use this for initialization
void Awake ()
{
if (time == null)
{
time = GameObject.FindWithTag ("gameManager");
}
else
{
time = null;
}
}