Find inactive child of Gameobject

i searched all over internet but nothing worked for me, i instanciate prefabs inscene 5 prefabs and 1 is active, its character selection, when i click next next sets active.
in prefab i have hat gameobject inactive, and i want it to setActive on button.

i used

Hat=Gameobject.find
getcomponentinchildren
findgameobjectwithtag

but as its itactive i cant reference it.

any ideas?

thanks.

Don’t. Instead, store references to these objects in a list when you instantiate them, and then find them in that list.

4 Likes

Also, if you need to “deactivate” an object, often you can just disable the renderer (making it invisible) and, if necessary, the collider.

1 Like