Bind fields and properties of Monobehaviours
objects to a JSON file. Save, load, make changes to them at runtime.
- Install dependencies: com.yasirkula.runtimeinspector/ and jillejr.newtonsoft.json-for-unity.converters/
- In the Unity editor,
Window->Package Manager
add package from git url: https://github.com/seeyam-q/YouNeiTiToolbox.git#upm-bootstrapper
- Drag
Bootstrap
prefab into the main scene. - In your
MonoBehaviour
code, add System.Runtime.Serialization namespace, then add [DataMember(Name = "")] to any serialized properties that you want to be adjusted at runtime. - Add the
GameObject
with the aboveMonoBehaviour
component to theSettingPopulateList
ofBootstrapDictionary
on theBootstrap
prefab. - Enter the play mode and hit
Generate Bootstrap File
. AbootstrapSettings.json
will be created at eitherStreamingAsset
or Persistent Data Path based on your choice. Stop the play mode. - You are all set. Enter the play mode again. Hit
G
key to toggle the runtime inspector to change and save settings on the fly. You can useruntimeEditorKeyStroke
property to change the key binding for the bootstrap inspector.
- Bootstrap works better with reference types (class) than value types (struct). You can always create a
[Serializable]
class container to group similar settings together (regardless of reference types or value types) for better organizations.