Skip to content
JefferiesTube edited this page Mar 14, 2016 · 1 revision

HighlightBox

A box with round edges that can be colored and used to highlight some components

Imgur

  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);
  }

EditorBlock

A wrapper for vertical and horizontal oriented blocks that also accepts and additional style.

Imgur

  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);
  }

SwitchColor

A wrapper to change the GUIColor automatically without manually caching it and switching it back

Imgur

  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);

IndentBlock

A wrapper to indent controls

Imgur

  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);
  	}
  }

FoldableBlock

A simple foldable block with a header. Can have an optional icon.

Imgur

  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);
  	}
  }
Clone this wiki locally