unity-mod-manager
unity-mod-manager copied to clipboard
EnableReloading attribute on class, but CanReload is still false
The entire source file is this:
using UnityModManagerNet;
namespace Mod {
[EnableReloading]
static class Main {
static bool Load(UnityModManager.ModEntry entry) {
UnityModManager.Logger.Log(string.Format("hello test. reload: {0}", entry.CanReload), "[Mod] ");
return true;
}
}
}
It prints false
. I opened the DLL in dnSpy and it looks like the annotation is still there. What gives? I would have expected this check to pass:
https://github.com/newman55/unity-mod-manager/blob/c525b6f19f09b35233b5be3621dcaff75ad8d55d/UnityModManager/ModManager.cs#L600-L602
The reload button simply does not show up in the ctrl+f10 menu.
typeof(UnityModManager.ModEntry).GetProperty("CanReload").SetValue(entry, true, null);
works 🤡
Strange, it usually always worked. Because the method and the property are in the same object.
Weird, looks like reloading also doesn't load the new assembly properly, still getting a log message I removed even after wiping all the DLLs (including the cached one) and hitting reload. Looks like reload is just generally too unreliable, just going to be restarting the game as usual then
Yes it is, with each new unity version, the restart becomes more and more difficult.
I discovered over a year later by looking through UMM's code that you must declare a minimum manager version of at least 0.13. This is not documented anywhere, but adding this to the info.json makes it work
"ManagerVersion": "0.23.5.0",
This issue can be closed once the wiki says that you need this in order to make reloading work.