> For the complete documentation index, see [llms.txt](https://tobar-io.gitbook.io/thock/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tobar-io.gitbook.io/thock/documentation/convert-json-to-soundpack/convertjsontosoundpack.md).

# 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.
