- Home /
Duplicate Question
Unity UI Button
Is there effective way to dedect OnclickUp and OnclickDown with the new UI button available in Unity4.6
Answer by Fornoreason1000 · Dec 27, 2014 at 07:18 AM
Duplicate Question! Please do not double post your question, as it is really just confuses other users. but i can't say i can blame you since the docs DO NOT TELL You this very well but it is supposed to be there.
http://docs.unity3d.com/ScriptReference/UI.Selectable.OnPointerUp.html and here http://docs.unity3d.com/ScriptReference/UI.Selectable.OnPointerDown.html
to use these add a event Trigger system component to your button then add two trigger types OnPointerUP and OnPointerDown, once there select your object(s) then select your Function(s) to be called when the trigger is activated
now unlike GetButtonDown from the Input class OnPointerDown and OnPointerUp is only called on the frame you press the button down and release the button respectively.
if you read the links it vaguely suggests how they work... all it tells you its "evaluated" by the event system, which it says for all event triggers. and it switched to the pressed state.(it too bad the docs aren't like a wiki entry where mods can edit them on site)
Follow this Question
Related Questions
While mouse is pressed and moved to a button, button should be pressed as well 0 Answers
Changing Color of Material with Bool and Unity UI 1 Answer
UI Buttons Not Working Except In Development 0 Answers
UI Button and Color Tint Transition issue 0 Answers
Strange UI Button hover offset when using Worldspace Canvas in VR 4 Answers