unity3d UIButton added click event

unity3d UIButton added click event

public UIButton startButtonUser; // Start the user interface login button 
void the Awake () 
{ 
    // initialization parameter 
    startButtonUser = transform.FindChild ( " Start / ButtonUser " ) .GetComponent <UIButton> (); 

    // define event 
    EventDelegate btnUserEvent = new new EventDelegate ( the this , " OnStartButtonUserClick " ); 
    startButtonUser.onClick.Add (btnUserEvent); 
}

Custom event

public void OnStartButtonUserClick()
{
    Debug.Log ("On StartButtonUser Click...");
}

 

Guess you like

Origin www.cnblogs.com/herd/p/12404485.html