protected virtual IEnumerator InitalizeWait(Config config) { while (!HotfixILRManager.GetInstance().IsInit) { yield return(null); } }
void Update() { if (_assembly == null) { _assembly = HotfixILRManager.GetInstance().assembly; } if (_assembly == null) { return; } #region GuideManager //记录服务器收到数据情况 isReceiveGuideNodes = (bool)MonoGetStaticField("Hotfix_LT.UI.GuideNodeManager", "isReceiveGuideNodes"); isReceiveCompletedData = (bool)MonoGetStaticField("Hotfix_LT.UI.GuideNodeManager", "isReceiveCompletedData"); //----- IsGuide = (bool)MonoGetStaticProperty("Hotfix_LT.UI.GuideNodeManager", "IsGuide"); IsRunGuide = (bool)MonoGetStaticProperty("Hotfix_LT.UI.GuideNodeManager", "IsRunGuide"); isFirstCombatGuide = (bool)MonoGetStaticMethod("Hotfix_LT.UI.GuideNodeManager", "isFirstCombatGuide"); combatLimitClick = (bool)MonoGetStaticProperty("Hotfix_LT.UI.GuideNodeManager", "combatLimitClick"); IsVirtualBtnGuide = (bool)MonoGetStaticField("Hotfix_LT.UI.GuideNodeManager", "IsVirtualBtnGuide"); VirtualBtnStr = MonoGetStaticField("Hotfix_LT.UI.GuideNodeManager", "VirtualBtnStr") as string; isFuncOpenGuide = (bool)MonoGetStaticField("Hotfix_LT.UI.GuideNodeManager", "isFuncOpenGuide"); FuncOpenGuideId = MonoGetStaticField("Hotfix_LT.UI.GuideNodeManager", "FuncOpenGuideId") as string; GateString = MonoGetStaticField("Hotfix_LT.UI.GuideNodeManager", "GateString") as string; partnerStatID = (int)MonoGetStaticField("Hotfix_LT.UI.GuideNodeManager", "partnerStatID"); currentGuideId = (int)MonoGetStaticProperty("Hotfix_LT.UI.GuideNodeManager", "currentGuideId"); listCompleteFirstStepID = (List <int>)MonoGetStaticField("Hotfix_LT.UI.GuideNodeManager", "listCompleteFirstStepID"); //---- _startTime = (float)MonoGetStaticField("Hotfix_LT.UI.GuideNodeManager", "_startTime"); _serverSaveStr = MonoGetStaticField("Hotfix_LT.UI.GuideNodeManager", "_serverSaveStr") as string; _beforeMemoryTime = (float)MonoGetStaticField("Hotfix_LT.UI.GuideNodeManager", "_beforeMemoryTime"); #endregion }
/// <summary> /// 初始化ILR,可主动调用 /// </summary> public void ILRObjInit() { if (ilinstance == null && !string.IsNullOrEmpty(hotfixClassPath)) { #if ILRuntime ilinstance = HotfixILRManager.GetInstance().appdomain.Instantiate <UIControllerILRObject>(hotfixClassPath); #else var type = HotfixILRManager.GetInstance().assembly.GetType(hotfixClassPath); ilinstance = System.Activator.CreateInstance(type) as UIControllerILRObject; #endif ilinstance.SetUIController(this); BindingParam(); base.Awake(); if (ilinstance != null) { ilinstance.Awake(); if (IsFixShader) { //修正Shader GM.AssetUtils.FixShaderInEditor(this); } } } }
/// <summary> /// Call ILR的带instance的class的方法 /// </summary> /// <param name="hotfixClassPath"></param> /// <param name="instance"></param> /// <param name="methodName"></param> /// <param name="p"></param> /// <returns></returns> public static object CallStaticHotfixEx(string hotfixClassPath, string instance, string methodName, params object[] p) { if (!Application.isPlaying) { return(null); } if (!HotfixILRManager.GetInstance().IsInit) { return(null); } #if ILRuntime IType type = HotfixILRManager.GetInstance().appdomain.LoadedTypes[hotfixClassPath]; PropertyInfo property = type.ReflectionType.GetProperty(instance); object obj = property.GetValue(null); if (obj == null) { return(null); } IMethod m = type.GetMethod(methodName, p.Length); return(HotfixILRManager.GetInstance().appdomain.Invoke(m, obj, p)); #else return(UseMonoReflectOneRes(hotfixClassPath, instance, methodName, p)); #endif }
protected override IEnumerator InitalizeWait(Config config) { yield return(base.InitalizeWait(config)); string Core = "Hotfix_LT.UI.LTHotfixManager"; #if ILRuntime logicObject = HotfixILRManager.GetInstance().appdomain.Instantiate <LogicILRObject>(Core); #else var type = HotfixILRManager.GetInstance().assembly.GetType(Core); logicObject = System.Activator.CreateInstance(type) as LogicILRObject; #endif logicObject.Initialize(config); }
public void ILRObjInit() { if (dlinstance == null && !string.IsNullOrEmpty(hotfixClassPath)) { #if ILRuntime dlinstance = HotfixILRManager.GetInstance().appdomain.Instantiate <DataLookILRObject>(hotfixClassPath); #else var type = HotfixILRManager.GetInstance().assembly.GetType(hotfixClassPath); dlinstance = System.Activator.CreateInstance(type) as DataLookILRObject; #endif dlinstance.SetDataLookup(this); base.Awake(); if (dlinstance != null) { dlinstance.Awake(); } } }
/// <summary> /// Call ILR的静态方法 /// </summary> /// <param name="hotfixClassPath"></param> /// <param name="methodName"></param> /// <param name="p"></param> /// <returns></returns> public static object CallStaticHotfix(string type, string method, params object[] p) { if (!Application.isPlaying) { return(null); } if (!HotfixILRManager.GetInstance().IsInit) { return(null); } #if ILRuntime return(GetHotfixMthod.Instance.InvokeHotfixMethod(type, null, method, p)); #else var t = HotfixILRManager.GetInstance().assembly.GetType(type); return(t.GetMethod(method).Invoke(null, p)); #endif }
//mono调用反射返回1个值 private static object UseMonoReflectOneRes(string hotfixClassPath, string instance, string methodName, object[] ilParams) { #if !ILRuntime Type type = HotfixILRManager.GetInstance().assembly.GetType(hotfixClassPath); PropertyInfo property = type.GetProperty(instance); object obj = property.GetValue(null); if (obj != null) { return(type.GetMethod(methodName).Invoke(obj, ilParams)); } else { return(null); } #else return(null); #endif }
public static void CallFixedUpdateMono() { if (!mCallFixedUpdateMono_Got) { #if ILRuntime var iType = HotfixILRManager.GetInstance().appdomain?.GetType(mType); mCallFixedUpdateMono = iType?.GetMethod("FixedUpdate", 0); #else var t = HotfixILRManager.GetInstance().assembly?.GetType(mType); mCallFixedUpdateMono = t?.GetMethod("FixedUpdate"); #endif mCallFixedUpdateMono_Got = mCallFixedUpdateMono != null; } #if ILRuntime HotfixILRManager.GetInstance().appdomain.Invoke(mCallFixedUpdateMono, null, null); #else mCallFixedUpdateMono?.Invoke(null, callFixedUpdateMonoParameters); #endif // GlobalUtils.CallStaticHotfix("Hotfix_LT.ILRUpdateManager", "FixedUpdate", ilrObject); }
/// <summary> /// 初始化ILR,可主动调用 /// </summary> public void ILRObjInit() { if (_ilrObject == null && !string.IsNullOrEmpty(hotfixClassPath)) { #if ILRuntime _ilrObject = HotfixILRManager.GetInstance().appdomain.Instantiate <DynamicMonoILRObject>(hotfixClassPath); #else var type = HotfixILRManager.GetInstance().assembly.GetType(hotfixClassPath); //UnityEngine.Debug.LogError("type :"+ type.Name); _ilrObject = System.Activator.CreateInstance(type) as DynamicMonoILRObject; #endif _ilrObject.SetMono(this); if (_ilrObject != null) { _ilrObject.Awake(); } } }
/// <summary> /// 调用热更方法(可缓存方法) /// </summary> /// <param name="TypeName">类型名</param> /// <param name="MethodName">方法名</param> /// <param name="parmType">参数类型数组,无则为null</param> /// <param name="instance">实例,静态方法为null</param> /// <param name="param">参数数组,无参数null</param> /// <returns></returns> public object InvokeHotfixMethod(string TypeName, string InstanceName, string MethodName, params object[] param) { object instance = null; if (!string.IsNullOrEmpty(InstanceName)) { instance = GetHotfixTypeAttribute(TypeName, InstanceName, null); } int parmNum = 0; IType itype = GetHotfixType(TypeName); if (itype == null) { return(null); } Dictionary <string, IMethod> methodDic; IMethod Method; if (!IMethodDic.TryGetValue(TypeName, out methodDic) || !methodDic.TryGetValue(MethodName, out Method)) { parmNum = param == null? 0 : param.Length; Method = itype.GetMethod(MethodName, parmNum); if (Method == null) { EB.Debug.LogError("Can not find Hotfix IMethod: {0}:{1}", TypeName, MethodName); return(null); } if (methodDic == null) { methodDic = new Dictionary <string, IMethod>(); IMethodDic[TypeName] = methodDic; } methodDic[MethodName] = Method; } obj = HotfixILRManager.GetInstance().appdomain.Invoke(Method, instance, param); return(obj); }
private IType GetHotfixType(string TypeName) { if (!HotfixILRManager.GetInstance().IsInit) { return(null); } IType itype; if (!ITypeDic.TryGetValue(TypeName, out itype)) { itype = HotfixILRManager.GetInstance().appdomain.GetType(TypeName); if (itype == null) { EB.Debug.LogError("Can not find Hotfix Itype: {0}", TypeName); return(null); } ITypeDic[TypeName] = itype; } return(itype); }
//参数是string,返回也string,可以直接用上面的变长参数 public static string GetTemplateToStringGetString(string hotfixClassPath, string instance, string methodName, string economyid) { #if ILRuntime IType type = HotfixILRManager.GetInstance().appdomain.LoadedTypes[hotfixClassPath]; Type t = type.ReflectionType; PropertyInfo property = t.GetProperty(instance); object obj = property.GetValue(null); IMethod m = type.GetMethod(methodName, 1); using (var ctx = HotfixILRManager.GetInstance().appdomain.BeginInvoke(m)) { ctx.PushObject(obj); ctx.PushObject(economyid); ctx.Invoke(); return(ctx.ReadObject <string>()); } #else return((string)UseMonoReflectOneRes(hotfixClassPath, instance, methodName, new object[] { economyid })); #endif }
public static bool GetHotfixToIntGetBool(string hotfixClassPath, string instance, string methodName, int param) { #if ILRuntime IType type = HotfixILRManager.GetInstance().appdomain.LoadedTypes[hotfixClassPath]; Type t = type.ReflectionType; PropertyInfo property = t.GetProperty(instance); object obj = property.GetValue(null); IMethod m = type.GetMethod(methodName, 1); using (var ctx = HotfixILRManager.GetInstance().appdomain.BeginInvoke(m)) { ctx.PushObject(obj); ctx.PushObject(param); ctx.Invoke(); return(ctx.ReadBool()); } #else return((bool)UseMonoReflectOneRes(hotfixClassPath, instance, methodName, new object[] { param })); #endif }
public static void UnRegisterNeedUpdateMono(IUpdateable ilrObject) { if (!mUnRegisterNeedUpdateMono_Got) { #if ILRuntime var iType = HotfixILRManager.GetInstance().appdomain.GetType(mType); mUnRegisterNeedUpdateMono = iType.GetMethod("UnRegisterNeedUpdateMono", 1); #else var t = HotfixILRManager.GetInstance().assembly?.GetType(mType); mUnRegisterNeedUpdateMono = t?.GetMethod("UnRegisterNeedUpdateMono"); #endif mUnRegisterNeedUpdateMono_Got = mUnRegisterNeedUpdateMono != null; } #if ILRuntime HotfixILRManager.GetInstance().appdomain.Invoke(mUnRegisterNeedUpdateMono, null, ilrObject); #else unParameters[0] = ilrObject; mUnRegisterNeedUpdateMono?.Invoke(null, unParameters); #endif // GlobalUtils.CallStaticHotfix("Hotfix_LT.ILRUpdateManager", "UnRegisterNeedUpdateMono", ilrObject); }
public Type GetHotfixType(string TypeName) { if (!HotfixILRManager.GetInstance().IsInit) { return(null); } if (TypeDic.ContainsKey(TypeName)) { type = TypeDic[TypeName]; } else { type = HotfixILRManager.GetInstance().assembly.GetType(TypeName); if (type == null) { EB.Debug.LogError("Can not find Hotfix type:" + TypeName); return(null); } TypeDic.Add(TypeName, type); } return(type); }
void OnApplicationFocus(bool focusStatus) { // first called after Awake //EB.Debug.Log("GameEngine.OnApplicationFocus: status = {0}", focusStatus); GameStateManager.Instance.OnFocus(focusStatus); if (GameStateManager.Instance.State >= eGameState.Login) { SparxHub.Instance.OnFocus(focusStatus); } bool isSceneLoop = false; if (HotfixILRManager.GetInstance().IsInit) { isSceneLoop = (bool)GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.SceneLogic", "isSceneLoop"); } if (isSceneLoop /*isSceneLoop*//*SceneLogic.SceneState == SceneLogic.eSceneState.SceneLoop*/) { if (PerformanceManager.Instance.CurrentEnvironmentInfo.slowDevice) { //setDesignContentScale(1334,750); } } }
public static void AutoBinding() { #if !ILRuntime UIControllerILR current = UnityEditor.Selection.activeGameObject.GetComponent <UIControllerILR>(); UIControllerILRObject instance = current.ilinstance; bool release = false; if (!string.IsNullOrEmpty(current.hotfixClassPath)) { var type = HotfixILRManager.GetInstance().assembly.GetType(current.hotfixClassPath); if (instance == null) { instance = System.Activator.CreateInstance(type) as UIControllerILRObject; release = true; } FieldInfo[] fields = type.GetFields(); TextAsset script = AssetDatabase.LoadAssetAtPath <TextAsset>(string.Concat("Assets/", current.FilePath)); if (script == null || script.text == String.Empty) { Debug.LogError("Could not read text by " + string.Concat("Assets/", current.FilePath)); return; } string[] rows = script.text.Split(new string[] { "\n" }, StringSplitOptions.None); string targetRow = string.Empty; foreach (FieldInfo f in fields) { System.Type fieldType = f.FieldType; Debug.LogFormat("field.Name = {0},field.Type.Name = {1}", f.Name, fieldType.Name); UIControllerILR.ParmType fieldEnumType; if (System.Enum.TryParse(fieldType.Name, out fieldEnumType)) { if (!current.ParmPathList.Exists(p => p.Name == f.Name)) { UIControllerILR.ParmStruct structural = new UIControllerILR.ParmStruct(); structural.Name = f.Name; structural.Type = fieldEnumType; for (int i = 0; i < rows.Length; i++) { string row = rows[i]; if (row.Contains(f.Name + " = t.") || row.Contains(f.Name + " = controller.transform.")) { targetRow = row; break; } } if (string.IsNullOrEmpty(targetRow)) { Debug.Log("<color=yellow>this filed has not found or got by awake method!</color>"); continue; } string[] parts = targetRow.TrimAll('"').Split('('); if (parts.Length > 1) { string text = parts[1].TrimAll('(', ')', ';', '.').Replace("gameObject", String.Empty).TrimEnd(); if (!string.IsNullOrEmpty(text)) { structural.Path = text.Replace(String.Format("GetComponent<{0}>", structural.Type.ToString()), ""); } Debug.LogFormat("Create ParmStruct: <color=purple>Name = {0},Type = {1},Path = {2}</color>", structural.Name, structural.Type, structural.Path); } current.ParmPathList.Add(structural); EditorUtility.SetDirty(current); } } else { Debug.Log("<color=red>field type is not feasible!</color>"); } } } if (release) { instance = null; AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); } #else EB.Debug.LogError("ILR模式下不存在assembly,会报错!请自行解决后再去掉这个宏。"); #endif }
public override IEnumerator Start(GameState oldState) { //debug服务器选择界面 debug screen view #if DEBUG && !NO_DEBUG_SCREEN DebugSystem.DebugCameraClearNothing(); #endif #if !UNITY_EDITOR && USE_AOSHITANGSDK EB.Sparx.AoshitangSDKManager.getInstance().AstSDKInit(); yield return(new WaitUntil(() => EB.Sparx.AoshitangSDKManager.getInstance().SDKInitSuccess)); //ShowWaitSDKInitScreen(false);花屏问题,得等loading出来再隐藏 #endif //获取本地的玩家设置 load playersetting UserData.DeserializePrefs(); //加载当前语言的基础包 EB.Localizer.LoadCurrentLanguageBase(UserData.Locale); //加载证书 load certificates EB.Net.TcpClientFactory.LoadCertStore("Crypto/Certs"); //加载hosts配置 load hosts EB.Net.DNS.LoadHosts("hosts"); //展示黑白提示界面,如果需要跳过请在协程内部最后加判断跳过 show warning loading yield return(GameEngine.Instance.StartCoroutine(LTDownloadHudConroller.instance.ShowWarningScreen())); //GameEngine.Instance.StartCoroutine(UIStack.Instance.ShowWarningScreen()); //显示普通loading界面(加载中。。。) show splash screen yield return(GameEngine.Instance.StartCoroutine(LTDownloadHudConroller.instance.ShowSplashScreen()));//GameEngine.Instance.StartCoroutine(ShowSplashScreen()); #if !UNITY_EDITOR && USE_AOSHITANGSDK ShowWaitSDKInitScreen(false); #endif //网络检测是否联网 confirm network yield return(LTDownloadHudConroller.instance.WaitForNetwork());//BlockForNetworkWithDialog(); #if USE_AOSHITANGSDK if (PlayerPrefs.GetInt("astfirstopen", -1) != 1) { EB.Sparx.AoshitangSDKManager.getInstance().UploadLog("firstOpen", delegate(bool scucess) { if (scucess) { PlayerPrefs.SetInt("astfirstopen", 1); PlayerPrefs.Save(); } }); } EB.Sparx.AoshitangSDKManager.getInstance().UploadLog("open", null); #endif EB.Debug.Log("USE_AOSHITANGSDK Pass!!!!"); //获取api跟ota服务器信息 fetch api sever and ota server yield return(GameEngine.Instance.StartCoroutine(FetchServerList())); EB.Debug.Log("FetchServerList Pass!!!!"); if (GameEngine.Instance.ServerMaintenance) { //服务器维护 server maintenance LTDownloadHudConroller.instance.ShowTip(GameEngine.Instance.MaintenanceMessage); yield break; } EB.Debug.Log("ServerMaintenance Pass!!!!"); #region 载AB包 //资源限制配置 resource limit GM.AssetManager.MaxDecompressQueueSize = 100; GM.AssetManager.MaxMemorySize = 200 * 1024 * 1024; GM.AssetManager.InitilizeThreadPool(); //加载本地包体中的bundles yield return(GameEngine.Instance.StartCoroutine(DownloadFromStreamingFolder())); EB.Debug.Log("DownloadFromStreamingFolder Pass!!!!"); //下载服务器的bundles yield return(GameEngine.Instance.StartCoroutine(DowloadFromOtaServer())); EB.Debug.Log("DowloadFromOtaServer Pass!!!!"); #region 强制回收GC System.GC.Collect(System.GC.MaxGeneration, System.GCCollectionMode.Forced); System.GC.WaitForPendingFinalizers(); System.GC.Collect(); #endregion EB.Debug.Log("GC Pass!!!!"); //背景下载资源限制配置 background download resource limit GM.AssetManager.MaxDecompressQueueSize = 100; GM.AssetManager.MaxMemorySize = 50 * 1024 * 1024; GM.BundleDownloader.threadPool.Resize(2); //保存版本文件信息 save version info if (UserData.InitedVersion != EB.Version.GetFullVersion()) { UserData.InitedVersion = EB.Version.GetFullVersion(); UserData.SerializePrefs(); } EB.Debug.Log("save version info Pass!!!!"); #endregion #region 加载CommonText InitBundleTextData(); yield return(_waitUntilBundleTextData); #endregion EB.Debug.Log("InitBundleTextData Pass!!!!"); //加载Bundle中的当前语言文本 yield return(LoadCurrentLanguageText()); EB.Debug.Log("LoadCurrentLanguageText Pass!!!!"); #if !UNITY_EDITOR //加载bundle配置表信息 load datacaches yield return(LoadAllDataCachesFromBundles()); #endif EB.Debug.Log("LoadAllDataCachesFromBundles Pass!!!!"); #region InjectFix初始化 Inject Init #if !UNITY_EDITOR yield return(IFix.InjectPatchManager.Instance.LoadScriptPatch()); #endif #endregion EB.Debug.Log("InjectPatchManager Pass!!!!"); #region ILR初始化 ILR Init EB.Coroutines.Run(HotfixILRManager.GetInstance().StartProcess()); while (!HotfixILRManager.GetInstance().IsInit) { yield return(null); } yield return(null); //多等一帧 给依赖HotfixILRManager.GetInstance().IsInit判断初始化的协程能执行 #endregion #region 初始化DynamicMonoILR EB.Debug.Log("DynamicMonoILR LTGameStateHofixController"); var mono = GameStateManager.Instance.gameObject.AddComponent <DynamicMonoILR>(); mono.hotfixClassPath = "Hotfix_LT.GameState.LTGameStateHofixController"; mono.ILRObjInit(); #endregion //初始化数据统计管理器 GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.FusionTelemetry", "Initialize"); #region 加载一坨不知道啥 EB.Assets.LoadAsyncAndInit <UnityEngine.Object>("CharacterDependencies", null, GameEngine.Instance.gameObject); EB.Assets.LoadAsyncAndInit <UnityEngine.Object>("fx_aura04_Blueuv_02", null, GameEngine.Instance.gameObject); EB.Assets.LoadAsyncAndInit <UnityEngine.Object>("fx_dj_Reduv_fx02", null, GameEngine.Instance.gameObject); EB.Assets.LoadAsyncAndInit <UnityEngine.Object>("fx_Glo_0049", null, GameEngine.Instance.gameObject); EB.Assets.LoadAsyncAndInit <UnityEngine.Object>("fx_glwo_guangyun", null, GameEngine.Instance.gameObject); EB.Assets.LoadAsyncAndInit <UnityEngine.Object>("fx_m_bai_s", null, GameEngine.Instance.gameObject); #endregion EB.Debug.Log("GameDownload Pass!!!!"); }
/// <summary> /// 加载预制完成的回调 /// </summary> /// <param name="assetname"></param> /// <param name="go"></param> /// <param name="successed"></param> protected virtual void OnAssetReady(string assetName, GameObject go, bool succ) { try { if (!succ) { //如果不成功 go 是null mLoading = false; EB.Debug.LogError("MenuCreater.OnAssetReady: load {0} failed", go.ToString()); if (mOnReady != null) { mOnReady(null); mOnReady = null; } return; } GlobalMenuManager.Instance.OpenUIPrefabEnd(menuPrefabName); if (!mLoading) { GameObject.Destroy(go); if (mOnReady != null) { mOnReady(null); mOnReady = null; } return; } PloadData data; data.AssetName = menuPrefabName; data.Go = go; if (!string.IsNullOrEmpty(hotfixClassPath)) { //EB.Coroutines.Run(Process(true, menuPrefabName, go)); if (HotfixILRManager.GetInstance().IsInit) { data.IsHotfix = true; OnPloadProcess(data); } else { if (m_IsManagerReadedHandler == 0) { m_IsManagerReadedHandler = ILRTimerManager.instance.AddTimer(50, int.MaxValue, delegate(int sequence) { if (HotfixILRManager.GetInstance().IsInit) { ILRTimerManager.instance.RemoveTimer(m_IsManagerReadedHandler); m_IsManagerReadedHandler = 0; data.IsHotfix = true; OnPloadProcess(data); } } ); } } } else { //EB.Coroutines.Run(Process(false, menuPrefabName, go)); data.IsHotfix = false; OnPloadProcess(data); } } catch (System.NullReferenceException e) { EB.Debug.LogError(e.ToString()); } }
/// <summary> /// 对加载预制完成的数据进行处理(热更的处理,预制嵌套的处理等) /// </summary> /// <param name="isHotfix"></param> /// <param name="assetName"></param> /// <param name="go"></param> /// <returns></returns> IEnumerator Process(bool isHotfix, string assetName, GameObject go) { if (isHotfix) { while (!HotfixILRManager.GetInstance().IsInit) { yield return(null); } } PrefabCreator[] pcs = go.GetComponentsInChildren <PrefabCreator>(true); for (int i = 0; i < pcs.Length; i++) { pcs[i].LoadAsset(); } PrefabLoader[] loaders = go.GetComponentsInChildren <PrefabLoader>(true); for (int i = 0; i < loaders.Length; i++) { loaders[i].LoadPrefab(); } bool isPloaded = false; while (!isPloaded) { isPloaded = true; for (int i = 0; i < pcs.Length; i++) { if (!pcs[i].isCurrendAssetLoaded) { isPloaded = false; break; } } if (!isPloaded) { yield return(null); } } bool isLoaded = false; while (!isLoaded) { isLoaded = true; for (int i = 0; i < loaders.Length; i++) { if (!loaders[i].IsAssetLoaded) { isLoaded = false; break; } } if (!isLoaded) { yield return(null); } } if (isHotfix) { if (go.GetComponent <UIControllerILR>() == null) { UIControllerILR ucr = go.AddComponent <UIControllerILR>(); ucr.hotfixClassPath = hotfixClassPath; ucr.ILRObjInit(); } else { UIControllerILR ucr = go.GetComponent <UIControllerILR>(); ucr.ILRObjInit(); } } OnAssetProcess(assetName, go); }