Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

unity ui button

using UnityEngine.UI;

public class ButtonScript : MonoBehaviour
{
	public Button btn;

	void Awake()
    {
		btn.onClick.AddListener(btnClicked);
	}

	void btnClicked()
    {
		Debug.Log("Button clicked");
	}
}
 
PREVIOUS NEXT
Tagged: #unity #ui #button
ADD COMMENT
Topic
Name
5+7 =