Weird that this hasn’t been suggested before!
Imagine how cool it would be for buttons to have a new trigger called “One Hold”. Which means, whenever a person holds a button down, it will do something.
The use-cases for this are very broad. But here’s a few:
- Hold a button down to auto-scroll a collection
- Hold a button as part of a game - to move an object, character, etc.
- Hold a button down to increase/decrease volume
- Hold a button to scroll a parallax scene with the scroll collection
- Hold a button to flip through pages of a PDF
For the actions, you’d need to define what is happening, rate of the change, and limits. For example, hold a button down to increase volume by .1 every .5 sec.until vol level 1.
Help me vote this up!
- YES, add an “On Hold” trigger to buttons!
- Nah don’t need.
Until this idea gets some love (votes) and we add this to our roadmap, here is a quick way to implement this behavior today.
- Add a dummy asset (ex: empty image asset) outside of your scene
- Add a Timer trigger, 0.2 seconds (adjust that timing to your liking), that calls your desired action (ex: “add one” to a counter)
- Hide that asset
- On your “button to hold”, add
- an “Is Pressed” trigger that shows that dummy assets
- an “Is Released” trigger that hides that dummy assets
I’ve actually set up one of these in an experience before. Alexis Camacho helped me get it working. It used a Value Operator called ButtonPressed with a value set to False. When a button was pressed, it would set this value to true and start a Time Asset for Countdown set to 3 seconds with a condition set on the trigger that when it reached zero to perform an action. Mine was more for confirmation of intention than anything else.
It would be really nice to have this as a trigger with 5 or so specific actions that could be used. I’m definitely voting for this.