playMaker

Author Topic: UI Button On Click Event LongPress / Hold  (Read 1562 times)

Handrews

  • Playmaker Newbie
  • *
  • Posts: 36
  • 3D Artist & Game Developer
    • Thetra Games Artstation
UI Button On Click Event LongPress / Hold
« on: December 29, 2020, 06:47:56 AM »
I'm trying that the action UI Button On Click Event detects when the user is holding the UI Button, but it only return events when the player raise the finger from the button, so i can't know when the button is pressed or not, just detect 1 single click...so i need an event that detects when an UI Button is pressed every frame or a key down and key up system but with UI Button.

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 773
Re: UI Button On Click Event LongPress / Hold
« Reply #1 on: December 29, 2020, 09:03:34 AM »
You can use:
- Event Trigger (component): Pointer Up, + send event () to Playmaker, but nobody does that and it cannot be deactivated. Plus only the first FSM can receive events from components.
- UI Events: UI Pointer Up, in the FSM on the button Game Object.

Handrews

  • Playmaker Newbie
  • *
  • Posts: 36
  • 3D Artist & Game Developer
    • Thetra Games Artstation
Re: UI Button On Click Event LongPress / Hold
« Reply #2 on: December 29, 2020, 09:43:49 AM »
I don`t understand that :(

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 773
Re: UI Button On Click Event LongPress / Hold
« Reply #3 on: December 30, 2020, 05:43:22 AM »
Sorry, a correction here, you actually need Pointer Down, which is triggered the moment the button is pressed, before being released (that's Pointer Up, when you lift the pressure with the mouse's cursor or your finger on a touchscreen).
Thus you code your FSM so as to keep doing something as long as it's not detecting Pointer Up.
UI Events need neither the Playmaker proxy component on the button nor even Unity native components to send events to a FSM that exists on the button Game Object. The FSM will receive these events naturally.
Just create a FSM on the button and use UI Events > Pointer Down as a Global transition for example.

Handrews

  • Playmaker Newbie
  • *
  • Posts: 36
  • 3D Artist & Game Developer
    • Thetra Games Artstation
Re: UI Button On Click Event LongPress / Hold
« Reply #4 on: December 30, 2020, 06:10:05 AM »
Ooohh now i get it!! It worked! Omg how i didn't realize it before....