unity assign button onclick
public Button yourButton;
void Start ()
{
Button btn = yourButton.GetComponent<Button>(); //Grabs the button component
btn.onClick.AddListener(TaskOnClick); //Adds a listner on the button
}
void TaskOnClick()
{
Debug.Log ("You have clicked the button!");
}
Also in C#:
- how to remove file changes in git
- c# null conditional
- c# object clone
- datagridview column color c#
- how consider the first caracter in Split c#
- unity connect to firebase
- redirect to https codeigniter
- stop unity editor playing
- install .net sdk ubuntu 20
- c# method info extension
- c# random string
- how to pass an optional parameter in c# mvc asp.net
- query into complex object using dapper
- unity try get component
- decimals not stored in azure tables
- c# type of generic is string
- How to search for a string from readline in c#
- raycast unity
- c# string remove special characters
- how to join array indexes with comma in c#
- c# Authorization has been denied for this request
- unity check when clicked on object
- c# integer to bit string
- unity drawline