Supported Edits
Hot Patch recompiles changed types with Roslyn and redirects live method calls with Harmony. This page covers the C# edits that work today.
Method bodies
Edit the body of any method that has a { } block or => expression body.
Works in:
MonoBehaviourscripts- Plain classes and static classes
- Structs
Supported C# inside method bodies includes switch expressions, pattern matching, null-conditional operators, local functions, and modern syntax supported by the bundled Roslyn compiler.
Static and instance methods
Both static and instance methods with a body are patchable. Abstract, extern, and bodyless partial declarations are skipped.
Properties and indexers
- Property
getandsetaccessors with a body - Auto-properties that you expand to a full accessor body
- Indexers (
this[int i]) with bodied accessors
Operator methods
User-defined conversion and arithmetic operators with method bodies can be patched when they meet the general method requirements.
Generic methods
Generic methods are supported through call-site patching. Hot Patch finds callers in the loaded domain and redirects them to the updated implementation.
If a generic method is never called from patchable code, it may not receive hooks. Edit a caller or press Recompile.
Generic types
Generic classes and structs are supported. Hot Patch resolves the open generic type and applies patches across closed constructed types loaded in Play Mode.
New instance fields (limited)
You can add new instance fields that did not exist when Play Mode started. They are compiled into a patch-state holder and become available inside patched method bodies.
This is not full Inspector-grade field hot-reload. Existing field values on live objects are not re-initialized. See Limitations.
Using directives
using statements in the edited file are respected during patch compilation.
Nullable types
Nullable reference types and nullable value types are fully supported.