Hello,
Does Reflection truly work on Android/IOS? For example,
Assembly testAssembly = Assembly.LoadFile("Test.dll");
Fails because it cannot find the file specified when I try run it on Android.
Thanks
Hello,
Does Reflection truly work on Android/IOS? For example,
Assembly testAssembly = Assembly.LoadFile("Test.dll");
Fails because it cannot find the file specified when I try run it on Android.
Thanks
I guess it should work According to the MonoCompatibility page. Assembly.Load() with a Byte array works even in the webplayer.
I guess your problem is where your file is located. Since you load it manually the file isn’t part of your build so you have to copy it manually somewhere from which you can load it. You might want to use one of those directories: Application.dataPath, Application.persistentDataPath or Application.temporaryCachePath
Also keep in mind when you load assemblies with classes derived from MonoBehaviour or Scriptableobject you can’t use them in Unity. The class for itself works, but AddComponent will fail since the class is unknown to the Assetdatabase of your project.
It works fine if you use only custom classes (not derived from MonoBehaviour).
Is there Really no way to include the dll when building an app in unity? Asking everyone to manually copy it to a destination on the phone is way too much of a hassle. It seems like quite a limitation, why would they not provide something like that?
– anon62807076Well, native code is a different story. <a href="http://unity3d.com/support/documentation/Manual/Plugins.html">Plugins (true native code dlls [pro / mobile only])</a> just have to be placed in the plugins folder and can be wrapped with a simple DllImport attribute. To automatically exclude certain code use <a href="http://unity3d.com/support/documentation/Manual/Platform%20Dependent%20Compilation.html">Platform Dependent Compilation</a> The DLLs have to be removed or added to the project manually. There's no way i know to exclude an assembly from a build that is placed in the assets folder.
– Bunny83