As in compile all the .jars, .mm and the .cs together as 1 DLL? Similar to what Parse did for their Unity Plugin. How did they compile everything into just one dll file?
Also does a Unity build for iOS compile dll files that are located in the Plugins/Android folder, and vice versa?
Because when I build an iOS project with a DLL that references any Java code using AndroidJavaObject, it fails (Cross compilation job .dll failed.). DLLs, as far as I know, can’t use conditional compilations, so I split my DLL into two, one for iOS and one for Android, but I’m hoping that when I build for iOS it will not try to compile the Android version, and vice versa.
I think (but are not sure) that you can create a new solution in your project in Mono or VS with all your scripts etc. and compile that to a DLL, you should then be able to import it into your unity3D project and call the scripts in the DLL from there. I can’t see why you would do this as it seems to sort of create additional work. If it is due to security reasons try to look into obfusicators for C# and java as the DLL can still be found and decompiled, as well as the Jar file.
That’s what I did, but I think I can only add C# scripts to the Mono Library project? I’m not sure if I can add the jars and mm files.
I’m trying to do this because I’m trying to clean my scripts to be easily reusable for different projects.
For now, I package them as a UnityPackage, but the scripts are scattered in different folders (jars and mm needs to be in Plugins folder and all). I’m hoping that I can simplify everything with just 1 DLL file, like what the Parse Unity plugin did.
aah so you wanna use the jar file as a Library/refference in C#? You can’t directly add them to a C# project but I think Unity3D have some sort of bridge using the “AndroidJavaObject” and “AndroidJavaClass”, and from my knowlegde it’s the same way Google play services and google admob is implemented but I’m very unsure. Try this site for starters: Unity - Manual: Create and use plug-ins in Android or try do a google search on “unity3d android java code plugins”
Yup, I do use the AndroidJavaObject as a bridge. So I have a C# script that calls my jar file. I want to wrap that C# script, along with the jar its referencing in just 1 DLL file.
Did you manage to work with just 1 DLL? I need this in an plugin where in a small part I want to behave differently on Editory, Android and IOS. Other codes are same so I want to export them in one DLL.
Just use conditional compiling if you need that behaviour. You can either do this in one project using multiple build configurations (which define different symbols) or in multiple projects, while one of those would contain the actual source files and the other ones are just linked to these files.