Field Support
Supported Field Operations
Adding, editing, renaming, and deleting fields are supported.
Some field edits will reset the field's value, such as changing static/const keywords or changing the field's type. Other field changes, including renaming, will preserve the field's value.
Unity Inspector Integration
Hot Reloaded fields integrate with the Unity Inspector:
- New Fields: Public fields or fields with the
[SerializeField]
attribute become visible in the Unity Inspector with their corresponding values. - Editing in Inspector: Hot reloaded fields can be edited via the Inspector in Play Mode.
Field Initializers Behavior
Most values/expressions are valid in field initializers. Editing a non-static field initializer does not affect field values in existing instances of a class.
Limitations
- Hot reloaded fields require full Unity recompilation to be edited via the Inspector in Edit Mode.
- Modifying multiple fields simultaneously will reset their values, even if changes would preserve a field's value when edited individually.
- Editing field initializers in generic classes is not supported.
- Patched field initializers are deferred until the field is accessed for the first time.
- Fields with a custom
Serializable
type will not be displayed in the Inspector. - Editing values of non-trivial types (e.g.,
UnityEvent
) in the Inspector is supported but generates this warning (opens in a new tab). - If Odin Inspector (opens in a new tab) was imported into a project with Hot Reload, after removing Odin, its custom Scripting Define Symbols (opens in a new tab) must be removed manually.