Closed plaidpants closed 2 years ago
So if what you try to do is not only for development process, then for now it is outside of my scope.
However, I think Unity loads libraries on first use. So if you just try to patch a library before loading it (and don't unload it later) then you may probably just not call any of it's function before patching and you'll be good to go. There are also other tools that will allow you to load DLLs more dynamically.
The main issue with Android is the libraries that are used by an apk built by Unity are I think stored in a location the app does not have write privileges for. So if I want to patch the library prior to use I need to load it from somewhere I do have write access such as Application.persistentDataPath. I've been trying to use dlopen() but this may be disabled in current android OS versions, going to try and use System.Load() next. I was able to get this working at runtime on Windows with the loading and unloading working in the editor, it was simpler than your code but not as portable as I need to use the Invoke() function instead of the normal DLLImport. The project I am using this for is this . If you know of any other DLL loading tools, specifically for Android, I would appreciate any direction or suggestions you can provide. Thanks.
If dlopen() is disabled, then I have no idea what to do. I have not worked much on Android, especially from .net. The only relevant thing that crosses my mind is that it was planned to add native dynamic DLL handling to .NET, so maybe that is or will soon be available in recent Unity.
Related #41
Any ideas how to make this work with Android? I am dynamically creating the library at runtime (patching a file) and would like to then load it.