Hi, sorry if this has been posted many times before but I didn’t find it in my searches.
Is there a way to access the styles used in the editor? I’m trying to make a control that looks and acts like the hierarchy view and I’d like it to use the same resources in case the GUI is updated in subsequent releases. Specifically I’d like to access the selected (active?) state for the foldout and label items. Is this possible currently?
Hi, welcome to the forum!
The EditorGUI class is analogous to the ordinary GUI class, but creates editor GUIs with the same style as the normal editor. There are foldout and label controls that you can use, but they don’t store their state as such, you have to do that yourself in the script.
Thanks for the welcome and the response. I may have been a little too general in my question. I already saw the label and the foldout controls in script, but what I’m not seeing is how to access the GUIStyle for a selected label or a selected foldout.
In the hierarchy view when you click on a foldout it highlights the background as blue. Is there a GUIStyle that can make this happen that is exposed through script? I know I can make one by hand but if the colors change then my stuff will stand out.
I’m very interested in this as well. Were you ever able to find a solution?
I have seen an implementation very similar to the built-in Unity Hierarchy panel in AngryAnt’s Path Package (view a preview of this here). I notice though that there are subtle differences between the tree in his Path Browser and Unity’s Hierarchy, such as the height of the selectable foldouts, which leads me to believe that he did not use a built-in implementation.
At this point, is it best to assume that implementing the more complex functions of a file tree (selectable foldouts, right-click functionality, etc) should be done by hand?