Skip to content
pointcache edited this page Jan 23, 2016 · 11 revisions

RabbitGUI was developed as part of VFW to replace GUIlayout. It has simpler, but unobvious workflow for some things. Every attribute drawer uses RabbitGUI, and accesses it through inherited gui property.

To start making custom inspector for better behavior you have to inherit from:

BaseBehaviourEditor for BetterBehaviour BaseScriptableObjectEditor or BetterScriptableObjectEditor for Better Scriptable Object

In there just override OnGUI() and start populating with ui instructions just as with GUILayout, but using gui .

RabbitGUI mimics GUILayout pretty well, many of standard things like buttons work the same way, but there are exceptions.

Horizontal/vertical

Unity GUI Layout:

GUILayout.BeginHorizontal(); 
{
    // code
}
GUILayout.EndHorizontal();

Rabbit:

using(gui.Horizontal())
{
    // code
}

Color

Unity:

var old = GUI.color;
GUI.color = Color.red;
// code..
GUI.color = old;

Rabbit:

using(gui.ColorBlock(Color.red))
{
 // code..
}

#State Unity:

var old = GUI.enabled;
GUI.enabled = x > y;
// code..
GUI.enabled = old;

Rabbit:

using(gui.State(x > y))
{
 // code..
}
Clone this wiki locally