Edit of asset "Hot Reload Live" Accepted

Old/Current New/Edit
Title Hot Reload Live Hot Reload Live
Description Save a .cs file — watch it run.

Hot Reload Live is a runtime C# hot reload plugin for Godot 4.7+ (.NET 8). It watches your project's source files, compiles changes into an isolated AssemblyLoadContext, diffs method signatures, and patches the running game via Harmony — all in-process.

No manual reload. No scene reset. No state loss.

FEATURES
- Static methods (void / return / ref / out / overloads)
- Instance methods (cross-ALC DynamicMethod IL stub)
- Generic methods (object covers all ref types + 8 common value types)
- async / Task MoveNext (CoreCLR-safe patch)
- IEnumerable / iterator MoveNext
- Field layout guard — skips patch on structural change
- Restore All — one-click unpatch
- Editor plugin menu (Restart Watcher / Manual Compile / Restore All)
- Isolated ALC — no file locks on the .godot mono temp bin folder
- Old ALC auto-unload (memory leak prevention)
- Self-contained addon — the download contains only addons/GodotHotReload, LICENSE and README

HOW IT WORKS
1. FileSystemWatcher (500 ms debounce)
2. dotnet build -> .hotswap/vN/ (isolated, no .godot lock)
3. AssemblyLoadContext.LoadFromStream (collectible, no file lock)
4. ComputeFieldHash check (skip patch if field layout changed)
5. Method diff (DispatchKey = full name + param types)
6. Harmony patch -> DynamicMethod IL stub
7. The game runs new code on the next frame

INSTANCE METHOD TRICK
A DynamicMethod stub forwards the old-ALC object reference directly as the new-ALC type's this pointer — no castclass, no type check. This bypasses the cross-ALC type-identity barrier that breaks naive MethodInfo.Invoke. Safe because the field-layout guard guarantees identical memory layout.

GENERIC METHOD TRICK
Harmony can't patch open generic definitions. We patch constructed instantiations — object covers all reference types (CoreCLR JIT shares code), plus 8 common value types (int, float, double, bool, long, byte, char, decimal).

INSTALLATION
1. Install from the Asset Library (the self-contained addons/GodotHotReload folder includes both the editor plugin and the game-side runtime), or copy that folder into your project manually.
2. Add this PackageReference to your .csproj: Lib.Harmony version 2.4.2 (it embeds MonoMod/Cecil internally — no other dependencies).
3. Project Settings -> Plugins -> enable Hot Reload Live.
4. Add the runtime node in your bootstrap scene: AddChild(new GodotHotReload.HotReloadRuntime());
5. Press F5. Edit any .cs file, save, watch the console.

REQUIREMENTS
- Godot 4.7+ (.NET / mono build — not GDScript, not Godot 3.x)
- .NET 8 SDK (for dotnet build)
- Lib.Harmony 2.4.2 NuGet package

LIMITATIONS
- Cannot change field layout (add/remove/rename instance fields) — the guard skips the patch; a restart is required
- Cannot add new types or change inheritance
- Generic methods cover object + 8 common value types; uncommon value types run the old version until restart
- async/iterator entry methods are skipped (only MoveNext is patched) — the logic after await/yield still updates
- Godot-generated bridge methods are never patched

CHANGELOG
v1.1.1
- Fixed patching of non-generic methods declared on generic types (per-instantiation constructed types)
- Addon folder is now self-contained for one-click Asset Library install

v1.1.0
- Instance methods — DynamicMethod IL-emit bypasses the cross-ALC type identity wall
- Generic methods — constructed instantiations (object + 8 value types)
- async / Task and iterator MoveNext patched
- Compiler-generated type filter (lambdas, state machines)

v1.0.0
- Static methods, field layout guard, Restore All, 500ms debounce watcher, isolated ALC + auto-unload

LICENSE
MIT. Includes Lib.Harmony 2.4.2 by Andreas Pardeike (MIT).

Source: https://github.com/gutian2000/hot-reload-live-godot
Save a .cs file — watch it run.

Hot Reload Live is a runtime C# hot reload plugin for Godot 4.7+ (.NET 8). It watches your project's source files, compiles changes into an isolated AssemblyLoadContext, diffs method signatures, and patches the running game via Harmony — all in-process.

No manual reload. No scene reset. No state loss.

FEATURES
- Static methods (void / return / ref / out / overloads)
- Instance methods (cross-ALC DynamicMethod IL stub)
- Generic methods (object covers all ref types + 8 common value types)
- async / Task MoveNext (CoreCLR-safe patch)
- IEnumerable / iterator MoveNext
- Field layout guard — skips patch on structural change
- Restore All — one-click unpatch
- Editor plugin menu (Restart Watcher / Manual Compile / Restore All)
- Isolated ALC — no file locks on the .godot mono temp bin folder
- Old ALC auto-unload (memory leak prevention)
- Self-contained addon — the download contains only addons/GodotHotReload, LICENSE and README

HOW IT WORKS
1. FileSystemWatcher (500 ms debounce)
2. dotnet build -> .hotswap/vN/ (isolated, no .godot lock)
3. AssemblyLoadContext.LoadFromStream (collectible, no file lock)
4. ComputeFieldHash check (skip patch if field layout changed)
5. Method diff (DispatchKey = full name + param types)
6. Harmony patch -> DynamicMethod IL stub
7. The game runs new code on the next frame

INSTANCE METHOD TRICK
A DynamicMethod stub forwards the old-ALC object reference directly as the new-ALC type's this pointer — no castclass, no type check. This bypasses the cross-ALC type-identity barrier that breaks naive MethodInfo.Invoke. Safe because the field-layout guard guarantees identical memory layout.

GENERIC METHOD TRICK
Harmony can't patch open generic definitions. We patch constructed instantiations — object covers all reference types (CoreCLR JIT shares code), plus 8 common value types (int, float, double, bool, long, byte, char, decimal).

INSTALLATION
1. Install from the Asset Library (the self-contained addons/GodotHotReload folder includes both the editor plugin and the game-side runtime), or copy that folder into your project manually.
2. Add this PackageReference to your .csproj: Lib.Harmony version 2.4.2 (it embeds MonoMod/Cecil internally — no other dependencies).
3. Project Settings -> Plugins -> enable Hot Reload Live.
4. Add the runtime node in your bootstrap scene: AddChild(new GodotHotReload.HotReloadRuntime());
5. Press F5. Edit any .cs file, save, watch the console.

REQUIREMENTS
- Godot 4.7+ (.NET / mono build — not GDScript, not Godot 3.x)
- .NET 8 SDK (for dotnet build)
- Lib.Harmony 2.4.2 NuGet package

LIMITATIONS
- Cannot change field layout (add/remove/rename instance fields) — the guard skips the patch; a restart is required
- Cannot add new types or change inheritance
- Generic methods cover object + 8 common value types; uncommon value types run the old version until restart
- async/iterator entry methods are skipped (only MoveNext is patched) — the logic after await/yield still updates
- Godot-generated bridge methods are never patched

CHANGELOG
v1.1.1
- Fixed patching of non-generic methods declared on generic types (per-instantiation constructed types)
- Addon folder is now self-contained for one-click Asset Library install

v1.1.0
- Instance methods — DynamicMethod IL-emit bypasses the cross-ALC type identity wall
- Generic methods — constructed instantiations (object + 8 value types)
- async / Task and iterator MoveNext patched
- Compiler-generated type filter (lambdas, state machines)

v1.0.0
- Static methods, field layout guard, Restore All, 500ms debounce watcher, isolated ALC + auto-unload

LICENSE
MIT. Includes Lib.Harmony 2.4.2 by Andreas Pardeike (MIT).

Source: https://github.com/gutian2000/hot-reload-live-godot
Category Tools Tools
License MIT MIT
Repository Provider GitHub GitHub
Repository Url https://github.com/gutian2000/hot-reload-live-godot https://github.com/gutian2000/hot-reload-live-godot
Issues Url https://github.com/gutian2000/hot-reload-live-godot/issues https://github.com/gutian2000/hot-reload-live-godot/issues
Godot version Godot 4.7 Godot 4.7
Version String 1.1.1 1.1.1
Download Commit 4bc65429e004ed4adb26b2ab11b5bc1191bf7cca 4bc65429e004ed4adb26b2ab11b5bc1191bf7cca
Download Url (Computed) https://github.com/gutian2000/hot-reload-live-godot/archive/4bc65429e004ed4adb26b2ab11b5bc1191bf7cca.zip https://github.com/gutian2000/hot-reload-live-godot/archive/4bc65429e004ed4adb26b2ab11b5bc1191bf7cca.zip
Icon Url https://raw.githubusercontent.com/gutian2000/hot-reload-live-godot/main/release/assets/icon_256.png
https://raw.githubusercontent.com/gutian2000/hot-reload-live-godot/main/release/assets/icon_256.png
Preview Insert
Type image
Image/Video URL https://raw.githubusercontent.com/gutian2000/hot-reload-live-godot/main/release/assets/screenshot_2_hotreload_moment.png
Thumbnail https://raw.githubusercontent.com/gutian2000/hot-reload-live-godot/main/release/assets/screenshot_2_hotreload_moment.png
Preview Insert
Type image
Image/Video URL https://raw.githubusercontent.com/gutian2000/hot-reload-live-godot/main/release/assets/screenshot_3_result_v2.png
Thumbnail https://raw.githubusercontent.com/gutian2000/hot-reload-live-godot/main/release/assets/screenshot_3_result_v2.png
Preview Insert
Type image
Image/Video URL https://raw.githubusercontent.com/gutian2000/hot-reload-live-godot/main/release/assets/screenshot_4_editor_menu.png
Thumbnail https://raw.githubusercontent.com/gutian2000/hot-reload-live-godot/main/release/assets/screenshot_4_editor_menu.png