[Unity] Button Event: OnPointerDown() and OnPointerUp()
The button component is built in the Unity UI layout, so we can simply to create the function to trigger the button event when user clicking. But if it is necessary to set the events of the button “pressed” and “released” separately, we can write a script to inherit the Button class, and override the OnPointerDown()
event and OnPointerUp()
event.