- Home /
Hierarchy Foldout Variables Wanted
Hey, I've been wanting to contract and retract certain GameObjects back into their parents by using hotkeys instead of having the designers click on each little arrow.(The Hierarchy tab) I don't think anyone has ever tried to do this before as it seems, even at multiple glances, a rather useless thing to try to do.
Creating a custom hierarchy tab by using editor window means bugs 'r' us.
If, god forbid, they use foldouts in their Hierarchy tab code to show the child and parent relationship and overall organization(which is very likely at this point...), I'd have to access the Hierarchy tab's script and find those individual bools via... Object Id?... Not even sure if I can do that. Has anyone accessed the hierarchy tab and gotten those foldouts? If so I'd be very interested to know 8 r.
There is the function EditorGUI.Foldout but I do not know if you have access to it for the hierarchy tab.
Answer by Statement · Mar 28, 2011 at 03:39 PM
You can hold down alt button when toggling expansion of an object to recursively open or close.
Hm? Hmmm, this could actually be good enough for the designers. I'll see what they say. Good catch sir.
Answer by Statement · Mar 28, 2011 at 01:47 PM
It sounds like you're talking about EditorGUI.FoldOut.
If you want to access the children you can access them from the game objects transform property.
Access to children, easy. $$anonymous$$aking a custom Inspector or GUI using foldouts, easy. Getting the hierarchy tab to contract or retract their children on key command, painful and possibly impossible. The only thing I can think of now is to create a custom hierarchy Tab by creating an editor window. Which I foresee bugs with 8 r. Feature not worth the bugs I say.
Answer by MiguelDeLaCruz · Mar 28, 2011 at 03:01 PM
Creating a custom hierarchy tab via editor window is out of the question as the bugs would just mount. Therefore Foldouts are a nono.
If, god forbid, they use foldouts in their Hierarchy tab code to show the child and parent relationship and overall organization, I'd have to access the Hierarchy tab's script and find those individual bools via... Object Id?... I hope not... Not even sure if I can do that.
That's why I hope there's some sort of hidden value in Unity's GameObject class. (prays)
It is done with foldouts, and nothing you can access from GameObject - it'll be something in the hierachy class in the editor somewhere
I agree with $$anonymous$$ike. It would be crazy to pack such information into the GameObject class. It's completely useless at runtime. Btw. you should edit your question if you want to add information to your question. You can post your own answer if it's an answer. A question is not a forum-thread. Take a look at the FAQs: http://answers.unity3d.com/faq
Yeah, after much needed thinking, they wouldn't store that information in the GameObject. Ay, if this is trully needed i'm going to have to find a way to access that hierarchy tab.
I have been using reflector to try and peek into the hierarchy window. There exist functions that can expand or collapse those foldouts but they are inaccessible through reflection due to security policies (or so I think - it's impossible to use reflection to invoke those members - I tried). I think the easiest solution is just to hold down ALT button when clicking the arrow. Oh btw, I found out about the ALT button while reading the code in reflector :) Haven't seen it mentioned elsewhere.