79081003

Date: 2024-10-12 12:40:29
Score: 1
Natty:
Report link

There are many ways to do it. One is through script, which is already shared in an answer on this post, and another is through UI by adding another component, "Event Trigger", to the game object you have a button component on and then add new event type which will be "PointerDown" and then you can pass the reference if the script and call the Jump method. Sharing the steps with pictures below.

Step 1 Step 2

And you can also remove the button component if you don't want to show the highlighting of the button. It will work fine with just the "Event Trigger" component along with the image component.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Imran Bin Azhar