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.
Last updated