-
Notifications
You must be signed in to change notification settings - Fork 25
OGButton
Lokkij edited this page Aug 5, 2014
·
12 revisions
Buttons are for clicking and stuff
| Variable | Type | |
|---|---|---|
| hiddenString | string |
For storing hidden string values |
| text | string |
Text displayed on the button |
| target | GameObject |
Message handler |
| message | string |
Message for the message handler |
| argument | string |
Argument for the message handler |
| action | Action |
Function pointer to use instead of message handler |
| enableImage | boolean |
Whether or not to use another sprite on top of the button |
| imageScale | float |
Scale of the sprite |
| imageOffset | Vector2 |
Offset of the sprite |
// UnityScript
var btn : OGButton = new GameObject ( "Button", OGButton ).GetComponent.<OGButton>();
btn.text = "Hello!";
btn.action = function () { Debug.Log ( "Clicked!" ); };
btn.transform.localPosition = new Vector3 ( 10, 10, 0 );
btn.transform.localScale = new Vector3 ( 300, 20, 1 );
btn.GetDefaultStyles ();// C#
OGButton btn = (OGButton) new GameObject ( "Button", typeof(OGButton) ).GetComponent<OGButton>();
btn.text = "Hello!";
btn.target = this.gameObject;
btn.message = "SomeFunctionName";
btn.argument = "a string argument";
btn.transform.localPosition = new Vector3 ( 10, 10, 0 );
btn.transform.localScale = new Vector3 ( 300, 20, 1 );
btn.GetDefaultStyles ();