On click function not working unity code example
Example: unity button onclick function not showing
Instead of selecting the C# class, select the GameObject that your script is attached to.
If your class is not attached to a GameObject, attach it to one (can be itself).
Also the method needs to have zero or one parameter, or it will not show up. [nicmarxp]