-
Notifications
You must be signed in to change notification settings - Fork 70
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
Assembly injection #93
base: master
Are you sure you want to change the base?
Conversation
@limoka can you rebase? |
562a0ed
to
af8fb61
Compare
@ds5678 rebased as you asked. Sorry it took a while, I was busy with IRL things. As far as I remember this one is blocked by lack of Linux support. Unfortunately I don't actually use Linux, and don't have enough knowledge about it to make these changes work there. I also included a commit I made, but never pushed. It should make this code work on Unity 2019. |
I'm hesitant to dedicate time towards reviewing this if it does not support all platforms. |
This PR allows users classes to be injected into assembly with the same name as their mod assembly, instead of
InjectedMonoTypes
.There are two benefits from this:
The changes are backwards compatible. Despite the classes now being defined in the mod assembly, they will still correctly deserialize because we inject classes into every assembly that exists.
To implement this I had to determine a list of possible assemblies very early, so plugins folder scanning is performed.Also I needed to modify contents of
ScriptingAssemblies.json
file in the game Data folder, because Unity seems to get a list of assemblies from there. A backup of original is created.I have implemented IAT hooking, so no files are modified now.
Assembly scanning now should be performed by mod loader by adding AssemblyInjectorComponent.
I have tested these changes on Core Keeper Unity 2021.3.14.