Skip to content

Data Item Long Press Action

DataItemLongPressAction sends a command after the pointer is held on a row element for a configured duration.

DataItemLongPressAction

Use it for touch-first actions like ContextMenu without needing custom press timers in your FSM.

What It Does

  • Starts timing on pointer down.
  • Sends one command when hold time reaches Hold Seconds.
  • Cancels if the same pointer is released or exits before the timer finishes.
  • Sends an OnLongPress system event to the root item GameObject.

Setup

  1. Add Data Item Long Press Action to the row object or control you want press-and-hold behavior on.
  2. Set Command (commonly ContextMenu).
  3. Set Hold Seconds to the required press duration.
  4. Optional: keep Require Direct Hit enabled so covered elements do not trigger.
  5. Optional: set Identifier if downstream logic needs control-specific routing.

Inspector Fields

Field Description
Command Row action command sent when long-press completes.
Hold Seconds Time (in seconds) required before firing.
Require Direct Hit Requires this exact GameObject to be the direct hit at pointer down.
Identifier Optional control label included with the request.

Runtime Notes

  • Timing uses unscaled time, so it still works when gameplay time scale changes.
  • Direct-hit eligibility is captured at pointer down and reused during the hold.
  • Only the same pointer that started the press can end or cancel it.

Tips

  • Keep Hold Seconds around 0.35 to 0.6 for mobile-friendly interaction.
  • Pair this with click actions to support both quick select and hold-for-menu behavior.
  • If long-press should work anywhere in the row hierarchy, disable Require Direct Hit.

See Also