将ClassLoader.cs中的代码
case CodeMode.ILRuntime:
{
Dictionary<string, UnityEngine.Object> dictionary = AssetsBundleHelper.LoadBundle("code.unity3d");
byte[] assBytes = ((TextAsset)dictionary["Code.dll"]).bytes;
byte[] pdbBytes = ((TextAsset)dictionary["Code.pdb"]).bytes;
//byte[] assBytes = File.ReadAllBytes(Path.Combine("../Unity/", Define.BuildOutputDir, "Code.dll"));
//byte[] pdbBytes = File.ReadAllBytes(Path.Combine("../Unity/", Define.BuildOutputDir, "Code.pdb"));
appDomain = new ILRuntime.Runtime.Enviorment.AppDomain();
MemoryStream assStream = new MemoryStream(assBytes);
MemoryStream pdbStream = new MemoryStream(pdbBytes);
appDomain.LoadAssembly(assStream, pdbStream, new ILRuntime.Mono.Cecil.Pdb.PdbReaderProvider());
ILHelper.InitILRuntime(appDomain);
this.allTypes = appDomain.LoadedTypes.Values.Select(x => x.ReflectionType).ToArray();
IStaticMethod start = new ILStaticMethod(appDomain, "ET.Entry", "Start", 0);
start.Run();
break;
}
改为
ET6早期版本的
Assembly modelAssembly = null;
foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
{
//string assemblyName = assembly.ManifestModule.Name;
string assemblyName = $"{assembly.GetName().Name}.dll";
if (assemblyName != "Unity.ModelView.dll")
{
continue;
}
modelAssembly = assembly;
break;
}
Type initType = modelAssembly.GetType("ET.Entry");
this.entry = Activator.CreateInstance(initType) as IEntry;
不知是否可以,还没试