HideFlags on children of visible objects.

No matter what I try, I can't get HideFlags.HideInHierarchy to perform like I expect it to. Should I be able to hide objects which are the children of visible objects? Blockquote

class HideFlagManager extends EditorWindow {

    @MenuItem("Whirld/Editor HideFlags Manager")

    static function Init() {

        var window = GetWindow(HideFlagManager);

        //window.autoRepaintOnSceneChange = true;

        window.Show();

    }

    function OnSelectionChange() {

        Repaint();

    }

    function OnGUI() {

        if(Selection.activeGameObject) {

            if(GUILayout.Button("Hide Selected")) {

                Selection.activeGameObject.hideFlags = HideFlags.HideInHierarchy;

                EditorUtility.SetDirty(Selection.activeGameObject);

            }

            if(GUILayout.Button("Hide Children of Selected")) {

                SetFlags(Selection.activeGameObject.transform, HideFlags.HideInHierarchy);

                EditorUtility.SetDirty(Selection.activeGameObject);

            }

            if(GUILayout.Button("Show Children of Selected")) {

                SetFlags(Selection.activeGameObject.transform, 0);

            }

        }

        else {

            GUILayout.Label("
(Select a GameObject to enable full functionality)
");

        }

        if(GUILayout.Button("Unhide All")) {

            for (var go : GameObject in Resources.FindObjectsOfTypeAll(GameObject)) {

                Debug.Log(go.name);

                if(go.hideFlags != HideFlags.HideAndDontSave) {

                    go.hideFlags = 0;

                    EditorUtility.SetDirty(go);

                }

            }

        }

    }

    function SetFlags(tr : Transform, hf : HideFlags) {

        for (var child : Transform in tr) {

            child.gameObject.hideFlags = HideFlags.HideInHierarchy;

            EditorUtility.SetDirty(child.gameObject);

            //SetFlags(child, hf);

        }

    }

}

One work around for now is if you call gameObject.active = false, then GameObject.active = true, it forces that entry in the Hierachy window to update (and therefore hide). I wrote a script similar to yours recently and thats how I made it work

You're not alone ;) But HideFlags are bugged at the moment (Unity 3.2). Didn't checked 3.3 yet, but there wasn't anything about HideFlags in the Release Notes.

if(showHierarchy)
{
foreach(Transform t in transform)
{
gameObject.SetActive(false);
t.hideFlags = HideFlags.None;
gameObject.SetActive(true);

			}
		}else{
			foreach(Transform t in transform)
			{
				gameObject.SetActive(false);
				t.hideFlags = HideFlags.HideInHierarchy;
				gameObject.SetActive(true);
				
			}
		}