Unity3d work log [button add click event]

【1】

Create a script and write a public method.
In the Unity engine interface, click the button to add the object containing the script, and select this method.
The default method can only have one parameter.

【2】

Get the Button component and add the delegate for the click event.
Button btn;
btn.onClick.AddListener(event method without parameters);
btn.onClick.AddListener(delegate() {event method with arbitrary parameters;});

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325484097&siteId=291194637