HideFlags Still Broken?

createdGO.hideFlags = HideFlags.HideInHierarchy isn’t doing anything for me. Has anyone made this work? I found a Unity Answers post here for reference

What did I expect to happen?
I create a child object of an instance at run-time and do exactly as the docs show, but I can still see the object in the hierarchy in the scene. I expected it to be hidden, hence “HideInHierarchy”.

I have need of this.

I know this is a bit old, but i ran into a similar problem. It seems like the hide flags are not checked by unity until the object activates. My problem was i set the hide flags in a awake function and wanted to be able to show it later via some diagnostic editor option.

Anyways, I know this solution sucks but if you cycle activated it works. ( again not ideal )

cmpnt.gameObject.hideFlags = (HideFlags)0;// unhide
cmpnt.gameObject.activated = false;
cmpnt.gameObject.activated = true;