How can I perform unity check if gameobject exists

764    Asked by AmitSinha in Java , Asked on Oct 13, 2022

I'm making an AI that checks if the player exists or not. How do I check if a certain object exists and put it in a boolean variable?

Answered by Antony Bence

try using GameObject.FindGameObjectsWithTag or GameObject.FindWithTag or by name (or namepath) GameObject.Find

bool playerexists = (GameObject.Find("player") != null) for unity check if gameobject exists

Your Answer


Parent Categories