You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a .NET Framework-adjacent environment like Unity Mono, the only way to do unloading is to load what you need into a separate AppDomain and then unload that domain. Unfortunately, in order to communicate between these domains, the runtime provides remoting proxies, and those are only generated for types which are MarshalByRefObject derived. Otherwise, the object is serialized in one domain then deserialized in the other. This would have unacceptable performance overhead, but even ignoring that, Unity would not behave, and at best you'd be unable to reliably create Unity object. At worst, you'd see hard-crashes.
It would be possible to just load a new copy of a given mot into memory, but that comes with its own set of problems. It would also require that the mod properly clean itself up when it is disabled, which the vast majority of mods simply do not do.
All that being said, the two uses you specified do not need unloading; they would just require a game restart. Both of them are, in fact, already possible with the functionality that BSIPA provides. BSIPA used to even have the updater built in, and a mod manager like plugin has existed (though not been published, in large part because of my own laziness) for years in the form of https://github.com/nike4613/BSIPA-ModList-BeatSaber. I believe that ModList does actually work at present, though I have not tested it myself.
For what that can be useful?
Idea:
LoadFile(path)
orLoadFromStream(stream)
orLoadFrom(byteArray)
likeAssembly.LoadFile(path)
The text was updated successfully, but these errors were encountered: