Created
May 23, 2017 11:56
-
-
Save nevarman/08b87e099f978f2feb8758546799e4ae to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static bool CustomFoldout(string title, bool display) | |
{ | |
var style = new GUIStyle("ShurikenModuleTitle") | |
{ | |
font = new GUIStyle(EditorStyles.label).font, | |
fontStyle = FontStyle.Bold, | |
border = new RectOffset(15, 7, 4, 4), | |
fixedHeight = 22, | |
contentOffset = new Vector2(20f, -2f) | |
}; | |
var rect = GUILayoutUtility.GetRect(16f, 22f, style); | |
GUI.Box(rect, title, style); | |
var e = Event.current; | |
var toggleRect = new Rect(rect.x + 4f, rect.y + 2f, 13f, 13f); | |
if (e.type == EventType.Repaint) | |
{ | |
EditorStyles.foldout.Draw(toggleRect, false, false, display, false); | |
} | |
if (e.type == EventType.MouseDown && rect.Contains(e.mousePosition)) | |
{ | |
display = !display; | |
e.Use(); | |
} | |
return display; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment