How do you disable the render or inactivity of the child object of another object?
Dec 27 '10 at 10:07 AM
You can set the active state of any GameObject and all of its children with SetActiveRecursively
You can also find individual children by name like this and disable their renderer individually with
// make the object invisible
renderer.enabled = false;
Dec 27 '10 at 10:17 AM
Beat me to it by 5 seconds, good job. You should also add that because it only searches in the GO's children it also has the benefit of not slowing everything down to a crawl like Find usually does.
... unless the game object has LOTS of children!
does setting an object to be inactive also removes its render?
The renderer itself is never removed unless you specifically remove the component. Deactivating a game object will result in the object not being rendered anymore.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
Once you sign in you will be able to subscribe for any updates here
Answers and Comments
The best place to ask and answer questions about development with Unity. Check out our FAQ for more information.
To help users post good questions and use the site effectively we have posted a tutorial video. Please check it out.
asked: Dec 27 '10 at 10:07 AM
Seen: 2880 times
Last Updated: Dec 27 '10 at 10:07 AM
change pivot of parent game object
All encompassing Game Object.
Can I limit a .Find to the Parents and Child and not the Scene?
Access a child from the parent or other gameObject.
Attaching a game object as a child during runtime?
Multiple cameras as child or assign coords/rot to main cam
Getting the topmost parent
Getting instance of an sub object rather than the original's subobject
Instantiate GameObject Parent targetting issue.