开启了之后就不走ab包加载代码了吧,就不用每次修改就点那个编译,走的是unity内部的编译。
开了就不能热重载了。
public void Start()
{
if (Define.EnableCodes)
{
GlobalConfig globalConfig = Resources.Load<GlobalConfig>("GlobalConfig");
if (globalConfig.CodeMode != CodeMode.ClientServer)
{
throw new Exception("ENABLE_CODES mode must use ClientServer code mode!");
}
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
Dictionary<string, Type> types = AssemblyHelper.GetAssemblyTypes(assemblies);
EventSystem.Instance.Add(types);
foreach (Assembly ass in assemblies)
{
string name = ass.GetName().Name;
if (name == "Unity.Model.Codes")
{
this.model = ass;
}
}
}
else
{
byte[] assBytes;
byte[] pdbBytes;
if (!Define.IsEditor)
{
Dictionary<string, UnityEngine.Object> dictionary = AssetsBundleHelper.LoadBundle("code.unity3d");
assBytes = ((TextAsset)dictionary["Model.dll"]).bytes;
pdbBytes = ((TextAsset)dictionary["Model.pdb"]).bytes;
if (Define.EnableIL2CPP)
{
HybridCLRHelper.Load();
}
}
else
{
assBytes = File.ReadAllBytes(Path.Combine(Define.BuildOutputDir, "Model.dll"));
pdbBytes = File.ReadAllBytes(Path.Combine(Define.BuildOutputDir, "Model.pdb"));
}
this.model = Assembly.Load(assBytes, pdbBytes);
this.LoadHotfix();
}
IStaticMethod start = new StaticMethod(this.model, "ET.Entry", "Start");
start.Run();
}