Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EnableReloading attribute on class, but CanReload is still false #86

Open
LoganDark opened this issue Sep 3, 2021 · 5 comments
Open

Comments

@LoganDark
Copy link
Contributor

LoganDark commented Sep 3, 2021

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:

if (type.GetCustomAttributes(typeof(EnableReloadingAttribute), true).Any())
{
CanReload = true;

The reload button simply does not show up in the ctrl+f10 menu.

@LoganDark
Copy link
Contributor Author

typeof(UnityModManager.ModEntry).GetProperty("CanReload").SetValue(entry, true, null);

works 🤡

@newman55
Copy link
Owner

newman55 commented Sep 3, 2021

Strange, it usually always worked. Because the method and the property are in the same object.

@LoganDark
Copy link
Contributor Author

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

@newman55
Copy link
Owner

newman55 commented Sep 3, 2021

Yes it is, with each new unity version, the restart becomes more and more difficult.

@LoganDark
Copy link
Contributor Author

LoganDark commented Oct 3, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants