-
Notifications
You must be signed in to change notification settings - Fork 33
Blocks
JefferiesTube edited this page Mar 14, 2016
·
1 revision
A box with round edges that can be colored and used to highlight some components
using (new HighlightBox())
{
EditorGUILayout.Slider("Range property", 5, 0, 10);
EditorGUILayout.TextField("Sample Field", GUILayout.Height(150));
EditorGUILayout.ObjectField("Object Field", null, typeof (Transform), true);
}
using (new HighlightBox(Color.red))
{
EditorGUILayout.Slider("Range property", 5, 0, 10);
EditorGUILayout.TextField("Sample Field", GUILayout.Height(150));
EditorGUILayout.ObjectField("Object Field", null, typeof(Transform), true);
}
A wrapper for vertical and horizontal oriented blocks that also accepts and additional style.
using (new EditorBlock(EditorBlock.Orientation.Vertical, "Box"))
{
EditorGUILayout.Slider("Range property", 5, 0, 10);
EditorGUILayout.TextField("Sample Field", GUILayout.Height(150));
EditorGUILayout.ObjectField("Object Field", null, typeof(Transform), true);
}
A wrapper to change the GUIColor automatically without manually caching it and switching it back
using (new SwitchColor(Color.cyan))
{
EditorGUILayout.Slider("Range property", 5, 0, 10);
}
using (new SwitchColor(Color.green))
{
EditorGUILayout.TextField("Sample Field", GUILayout.Height(150));
}
EditorGUILayout.ObjectField("Object Field", null, typeof(Transform), true);
A wrapper to indent controls
using (new IndentBlock())
{
EditorGUILayout.Slider("Range property", 5, 0, 10);
using (new IndentBlock())
{
EditorGUILayout.TextField("Sample Field", GUILayout.Height(150));
EditorGUILayout.ObjectField("Object Field", null, typeof (Transform), true);
}
}
A simple foldable block with a header. Can have an optional icon.
using (new FoldableBlock(ref state, "Foldable Block"))
{
if(state)
{
EditorGUILayout.Slider("Range property", 5, 0, 10);
EditorGUILayout.TextField("Sample Field", GUILayout.Height(150));
EditorGUILayout.ObjectField("Object Field", null, typeof (Transform), true);
}
}