- Home /
how to deactivate object but not children in inspector?
Hi,
I just started using Unity 4x and I notice a warning/capability seems to be missing that was present in 3x. I would like to deactivate a parent object using it's Inspector checkbox, but leave it's children objects active. In Unity 3x there used to be a dialog box that asked something like, "deactivate children?" but 4x doesn't have this. Is there any way to get this functionality back? Thanks.
Zaffer
Answer by cagezero · Apr 28, 2013 at 08:50 PM
Unity 4 made some pretty serious changes to the way game object active/inactive is handled. If you look, the children are actually still active, however they will report inactive in hierarchy, making them effectively inactive until the parent becomes active again. So no, I do not think you can get that functionality back.
http://docs.unity3d.com/Documentation/ScriptReference/GameObject.SetActive.html
O$$anonymous$$, thanks Cagezero. I mostly wanted visibility, so I am using the checkbox for mesh renderer which works pretty well.
Glad to help! If this has resolved the issue for you please consider marking this as the correct answer.
Your answer
Follow this Question
Related Questions
How to make public variable read-only during run-time? 3 Answers
Changing position in inspector changes rotation 1 Answer
Why Doesn't Getcomponent add script to game objects inspector automaticly? 1 Answer
Adding variables to inspector strings 1 Answer
Get game view window current width & height in script 1 Answer