- Home /
Android Touch Screen Button for touch and hold
Hi, I am using a simple UI Button in my canvas to fire. Right now, it is firing correctly when button is pressed. But is does nothing different when the button is pressed and held for some time. I have asked this question earlier also.
Basically what is the Android Touch screen alternative to this command - Input.GetButton("Fire1"). This will let me fire continuously on android phones. Thanks!!
Answer by breban1 · Aug 22, 2018 at 09:51 PM
To catch the "Down" action, you will need to add an "Event Trigger" component to your button with a "Pointer Down" as your event type.
I'm using Unity 5.4.4p1, so it may have changed since then but that's what I've used in the past.
Thanks my friend buIt you know I have already done that and that makes no different. It is still firing one time only. I wanna try something else.
Yes, that is correct. You will get the "Pointer Down" event, which you can then call a function that sets a variable to let you know that the Fire button was pressed. Then wait for your button up with your main button callback. It will work.