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?