On Click events in Unity

When creating buttons in Unity, there is a component that can be used to trigger events or methods when clicking on it: OnClick()

  • Click on the + icon. None (Object) is requiring a gameobject
  • In this example we are making a restart button

This method will be executed each time the Button gameobject is clicked

Also you can add more scripts and methods.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store