Unity3D: How to detect when a button is being held down and released [duplicate]
问题 This question already has answers here : How to detect click/touch events on UI and GameObjects (4 answers) Closed 1 year ago . I have a UI button. I want to show a text when the user is pressing the button and hide the text when the user releases the button. How can I do this? 回答1: You have to create your own custom button by extending Button class and override method OnPoiterDown and OnPointerUp. Attach MyButton component instead of Button to your gameobject using UnityEngine; using