LavaGang / MelonLoader

The World's First Universal Mod Loader for Unity Games compatible with both Il2Cpp and Mono
https://discord.gg/2Wn3N2P
Apache License 2.0
2.28k stars 466 forks source link

[Enhancement]: Hot reload for Mono mods #438

Open DomNomNomVR opened 1 year ago

DomNomNomVR commented 1 year ago

Describe the new feature or enhancement

I'm putting a bounty of $100 USD on this feature which would allow me to reload a mod I'm working on in a game like ChilloutVR without needing to restart the game.

RinLovesYou commented 1 year ago

As tempting as $100 would be, This is way out of scope for MelonLoader. The way Unity reloads assemblies in the editor requires a full AppDomain reload, which is just a big "nope" for us. we partially support hot-reloading of code on il2cpp games, by attaching visual studio as a debugger. That's sadly as far as we can go.

Windows10CE commented 1 year ago

You could probably do something similar to ScriptEngine for BepInEx, its not full hot-reload, but you can destroy the existing plugin behavior and load the new assembly in its place to get something very similar. https://github.com/BepInEx/BepInEx.Debug/blob/master/src/ScriptEngine/ScriptEngine.cs

RinLovesYou commented 1 year ago

Very well, i will open this back up for discussion and see if we can sort of implement this

DomNomNomVR commented 1 year ago

Yes, partial reload would still be helpful.