C# Reflection and Android/IOS

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).