- Home /
Hide Object in Hierarchy Window
I'm trying to make an object container which holds several game objects which aren't shown in the hierarchy window, but I can't seem to get the hideFlags property to work. Here's the script I currently have:
class ObjectContainerEditor extends Editor { function OnInspectorGUI() { if (GUILayout.Button("Create Object")) CreateObject(); }
function CreateObject() {
var newObj : GameObject = new GameObject();
newObj.transform.parent = target.transform;
newObj.hideFlags = HideFlags.HideInHierarchy;
}
}
It adds a new GameObject to the target object like it's supposed to, but the new object is still shown in the hierarchy window. What am I doing wrong?
Answer by Lucas Meijer 1 · Dec 30, 2009 at 12:29 AM
On a quick look, this seems like a bug. Could you be so kind to file it (Unity->Menu->Report a problem) ?
I've encountered this bug, too, and have submitted a report (Case 400029)
Answer by Veehmot · Nov 02, 2011 at 07:37 PM
Maybe you can try **EditorUtility.CreateGameObjectWithHideFlags**.
Your answer
![](https://koobas.hobune.stream/wayback/20220613191617im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
HideFlags on children of visible objects. 3 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Bug with displaying components in Inspector after hideFlags.NotEditable? 1 Answer
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Setting Scroll View Width GUILayout 1 Answer