Comment on page
Tools to help your game be more responsive
Interaction Tools is a collection of simple behaviors that help you deliver a more responsive user experience quickly, easily and with a high degree of quality.
These tools help you create hold event actions for your players and they come in a few flavors. A hold event is when your interface asks the player to click on a GUI element or press a specific button for some duration in order to activate the action.
All hold events let you specify the hold time and rather or not the system should use unscaled time.
Hold events are a nice alternative to confirmation popups and can be implemented as mouse events, Unity's new Input System action events or as legacy Input Manager's key events. Regardless of which variant you use they will all handle the following events.
Each type of hold has a Game Event and Unity Event variant. That is you can either have the hold invoke Game Events for each phase or Unity Events for each phase.
If you wanted the system to raise both Game Events and Unity Events the most efficent method would be to have the Unity Event invoke the Game Events.
This variant takes an Input Action (Unity's new Input System)
This variant type can take 1 or more KeyCodes. all KeyCodes provided must be held for the engagement to be registered.
This variant takes a collection of KeyCodes (Unity's legacy Input System)
This variant uses Unity's IPointer Down, Up and Exit handlers so will respond to mouse, touch, and anyhting else that triggers Unity's IPointer handlers.
Play On audio tools are simple components which will play an audio clip on the indicated events. This makes for a very simple system for applying UI audio.
Each Play On component takes an Output audio source and a Sound audio clip and can configure the Volume Scale of the clip. The Play On will play the clip through the output source when its engaged. The following variants are available.
This plays when the GameObject is clicked (uses iPointerClickHandler). You can configure rather or not the system should monitor left, right and middle clicks.
This plays when its PlayOneShot method is called. This can be used with other tools such as Buttons by attaching the PlayOneShot method to the button's Click event.
This plays when the GameObject is pressed (mouse down), (uses iPointerDownHandler). You can configure rather or not the system should monitor left, right and middle clicks.
This plays when the GameObject is entered (uses iPointerEnterHandler).
This plays when the GameObject is exited (uses iPointerExitHandler).
This plays when the GameObject is released (mouse up), (uses iPointerUpHandler). You can configure rather or not the system should monitor left, right and middle clicks.