# ConvertJsonToSoundpack

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tobar-io.gitbook.io/thock/documentation/convert-json-to-soundpack/convertjsontosoundpack.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
