samedi 20 février 2021

Does Unity supports AppDomain?

I am writing a small Unity program, which can load a .NET assembly file to check its types, because the need to unload the assembly, so the AppDomain is used, the demo code as follows:

AppDomain appDomain = AppDomain.CreateDomain("test");
byte[] bytes = File.ReadAllBytes(dllPath);
var assembly = appDomain.Load(bytes);
var types = assembly.GetTypes();

When this program load another Assembly-CSharp.dll file, the types got are always those defined in current project, don't know how to fix it, any help is appreciated.





Aucun commentaire:

Enregistrer un commentaire