Hello everyone,

I am a rookie, is in Unity4.6, how to bind the button event

Assuming you mean a UI button…

First, there are some great tutorials on this…

http://unity3d.com/learn/tutorials/modules/beginner/ui/ui-button

But second, the quick and dirty way is to add the UI Button, and a Canvas will be added as well. Notice the button has a Button component and at the bottom of it, there is section to for event handlers. Specifically, all buttons come out of the box with an OnClick handler.

Simply put, this mean that whatever method you set up here, will be called on the OnClick of your UI button (Full up and down). There is an object field that you will drag a game object into (or just select it). For instance, if you want to control your characters “Jump” method you implemented in your characters movement script, simply drag the character gameobject into the Object target of the OnClick handler. Then the drop down on the right hand side of the component will populate with all the available methods/functions/whatever assigned to that gameobject, both unity native functions, and any custome ones (like “Jump”) in your own assigned scripts.

For a function to show up in this list and be available to use on a UI Button, it MUST be PUBLIC, return type of VOID, and have ZERO or ONLY ONE input argument.

Watch the tutorials, they are really good. They explain it better than I can. The nitty gritty though is:

Add button (Canvas and Event System will be added as well)
Go to Button Script component on button.
See OnClick handler, click + sign to add new handler.
Drop your gameobject you wish to control in the Target
select function to execute OnClick in the dropdown.
Function MUST be public void and zero or one arg.

Good luck!