⌨️
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. Documentation
  2. Convert JSON to Soundpack

ConvertJsonToSoundpack

ConvertJsonToSoundpack.cs is a script used to convert JSON data into a SoundPack ScriptableObject (SO).

Fields

  • soundPackJson (TextAsset): The JSON data to be converted into a SoundPack_SO.

  • intToKeyCodeTable (IntToKeyCodeTable): The IdToKeyCodeTable used to map key codes in the JSON data to Unity's KeyCode values.

  • nameIdentifier (string): The identifier used to find the name of the sound pack in the JSON data.

  • keyIdentifier (string): The identifier used to find the key codes in the JSON data.

Methods

  • ParseSoundPack(): Parses the JSON data, creates a new SoundPack_SO, and saves it as a new asset in the project.

  • GenerateScriptableObject(): Generates a new SoundPack_SO and saves it as an asset.

Usage

Attach this script to a GameObject and set the required fields in the Inspector. Use the "Parse Sound Pack" context menu option to start the conversion process.

Note

The script includes a custom editor that provides warnings if any of the required fields are not set up correctly. Ensure all fields are filled before parsing.

Public Methods

  • GenerateFallback(): Generate random fallback keys for the current sound pack.

PreviousConvert JSON to SoundpackNextUtilities

Last updated 1 year ago