🚀Quick Start
Setup
Import the Thock asset into your Unity project.
Add the
Thockcomponent to the GameObject where you want to handle the sound playing. Just use the Component menu or drag and drop the Thock prefab into the scene.
Configuration
In the
Thockcomponent, assign aSoundPack_SOto thesoundPackfield. This is where you define what sound file to use and what keys trigger what sounds.If you want to use fallback keys (keys that play a random sound when pressed), set
useFallbackKeystotrue.Use the
onKeyevent to define custom behavior when a key is pressed and a sound is played.
SoundPack_SO
The SoundPack_SO is a ScriptableObject where you define the sound file to use and the mapping of keys to sounds. Each key is associated with a Vector2Int, where the x value is the position in the sound file (in milliseconds) and the y value is the length of the sound (in milliseconds).
Generate New Sound Pack
You can generate a new SoundPack_SO directly from the Unity Editor. In the Thock component, enter the name of the new sound pack in the New Asset Name field and click the Generate New Sound Pack button. The new SoundPack_SO will be created in the SoundPacks directory.
Custom Editor
Thock comes with a custom editor that allows you to easily generate new sound packs and set up your key mappings. The custom editor is automatically used when you select a GameObject with the Thock component in the Unity Editor.
Last updated