# Accessing Editor styles in editor scripts?

**URL:** <https://discussions.unity.com/t/accessing-editor-styles-in-editor-scripts/402844>\
**Category:** Editor Extensions\
**Tags:** IMGUI\
**Created:** [December 1, 2009, 10:34pm UTC](https://discussions.unity.com/t/accessing-editor-styles-in-editor-scripts/402844 "2009-12-01T22:34:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon\_1177385](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@anon\_1177385](https://discussions.unity.com/u/anon_1177385)\
**Post date:** [December 1, 2009, 10:34pm UTC](https://discussions.unity.com/t/accessing-editor-styles-in-editor-scripts/402844/1 "2009-12-01T22:34:54Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![andeeeee](https://avatars.discourse-cdn.com/v4/letter/a/51bf81/32.png) [@andeeeee](https://discussions.unity.com/u/andeeeee)\
**Post date:** [December 2, 2009, 11:10am UTC](https://discussions.unity.com/t/accessing-editor-styles-in-editor-scripts/402844/2 "2009-12-02T11:10:02Z")

</div>

Hi, welcome to the forum!

The [EditorGUI](http://unity3d.com/support/documentation/ScriptReference/EditorGUI.html) class is analogous to the ordinary GUI class, but creates editor GUIs with the same style as the normal editor. There are [foldout](http://unity3d.com/support/documentation/ScriptReference/EditorGUI.Foldout.html) and [label](http://unity3d.com/support/documentation/ScriptReference/EditorGUI.LabelField.html) controls that you can use, but they don’t store their state as such, you have to do that yourself in the script.

---

<div class="post-metadata">

**Author:** ![anon\_1177385](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@anon\_1177385](https://discussions.unity.com/u/anon_1177385)\
**Post date:** [December 2, 2009, 4:33pm UTC](https://discussions.unity.com/t/accessing-editor-styles-in-editor-scripts/402844/3 "2009-12-02T16:33:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anon\_85938448](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@anon\_85938448](https://discussions.unity.com/u/anon_85938448)\
**Post date:** [February 4, 2010, 12:06am UTC](https://discussions.unity.com/t/accessing-editor-styles-in-editor-scripts/402844/4 "2010-02-04T00:06:16Z")

</div>

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](http://angryant.com/wp-content/uploads/path/Tutorial%201%20-%20The%20basics.mov)). 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?
