Hello, I am wondering how to CHECK if a gameobject is active.
Thanks!
Hello, I am wondering how to CHECK if a gameobject is active.
Thanks!
gameObject.activeSelf is true if its active and false if its not.
However, and object can be active, but if its parent is not active it will function as if it were inActive.
you can check this with
gameObject.activeInHierarchy This is true if the object is active AND all its parents are active.
Many thanks for the short and very helpful information!
how do you check if its not active
Like this for example:
void CheckGameObject()
{
if (!yourGameObject.activeSelf)
{
// do something, if it is not active...
}
else
{
// do something, if it is active...
}
}