I am trying to set the text of a button programmatically that I made in UnityScript. This is way harded than it should be.
Here is my UnityScript code:
#pragma strict
var loginButton : UnityEngine.UI.Button;
function Start () {
var canvas = new GameObject ("canvas", Canvas);
var instance : UnityEngine.UI.Button = Instantiate(loginButton);
instance.GetComponent<GUIText>().text = "login"; // doesnt work
instance.transform.position = Vector2(0,0);
instance.transform.SetParent(canvas.transform);
}