⌨️
Thock
Get Thock
  • About
    • ⌨️Description
    • 🚀Quick Start
    • ™️Third-Party information
    • Sample Scenes
      • Example_ScreenTypewriter-and-Soundpacks
      • Example_Type
      • Example_StringEvents
  • Documentation
    • Thock
    • Convert JSON to Soundpack
      • ConvertJsonToSoundpack
    • Utilities
      • StringEventListener
        • StringEventListener Component Tutorial
      • KeyPressEventReceiver
      • KeyPressEventSender
    • Scriptable-Objects
      • SoundPackSO
      • IntToKeyCodeTable
      • StereoAudioMapping
      • StringToKeycodeTable
    • Types
      • SoundMap
Powered by GitBook
On this page
  1. About

Quick Start

PreviousDescriptionNextThird-Party information

Last updated 1 year ago

Setup

  1. Import the Thock asset into your Unity project.

  2. Add the component 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

  1. In the component, assign a to the soundPack field. This is where you define what sound file to use and what keys trigger what sounds.

  2. If you want to use fallback keys (keys that play a random sound when pressed), set useFallbackKeys to true.

  3. Use the onKey event 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.

🚀
Thock
Thock
SoundPack_SO