-
Notifications
You must be signed in to change notification settings - Fork 25
OGFieldContainer
Jeppe Zapp edited this page May 13, 2014
·
2 revisions
This class implements procedural drawing similar to OnGUI, but without the extra draw calls.
// UnityScript
public class MyClass extends OGFieldContainer {
private var myFloat : float;
private var myInt : int;
private var myBool : boolean;
override function Fields () {
// This sets the width of this container, only used for layout purposes
width = 300;
// These widgets will be drawn with automatic layout
myFloat = FloatField ( "My float", myFloat );
myInt = IntField ( "My int", myInt );
myBool = Toggle ( "My bool", myBool );
if ( Button ( "Click me!" ) ) {
Debug.Log ( "Hello!" );
}
// This button will be drawn with a custom Rect, but still positioned according to the layout
if ( Button ( "Reset", new Rect ( 20, offset.y + 30, 100, 30 ) ) ) {
myFloat = 0;
myInt = 0;
myBool = false;
}
}
}