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.
Invoked when the user first engages the interface element
Invoked if the user canceled the operation before it completes
Invokes if the user holds the engagement for the specified duration
Invokes every frame that the user is holding the engagement, this will pass a float value between 0 and 1 indicating the progress at that frame.
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
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.