IEnumerator TestInstanceLoad() { if (instanceLoader != null) { Log.Debug("alread exist !"); yield break; } var path = "UI/Login.prefab"; instanceLoader = InstanceAssetLoader.Load(path); while (!instanceLoader.IsCompleted) { yield return null; } Log.Debug("load complete"); // assetLoader.InstanceAsset.transform.SetParent(this.transform); }
/// <summary> /// After Init Modules, coroutine /// </summary> /// <returns></returns> public override IEnumerator OnGameStart() { // Print AppConfigs Log.Info("======================================= Read Settings from C# ================================="); foreach (GameConfigSetting setting in GameConfigSettings.GetAll()) { Debug.Log(string.Format("C# Read Setting, Key: {0}, Value: {1}", setting.Id, setting.Value)); } yield return(null); Log.Info("======================================= Open Window 'Login' ================================="); UIModule.Instance.OpenWindow("Login", 888); // Test Load a scene in asset bundle SceneManager.LoadScene("Scene/TestScene/TestScene.unity"); // 开始加载我们的公告界面! //UIModule.Instance.OpenWindow("Billboard"); // 测试Collect函数,立即回收所有资源 var path = "ui/billboard.prefab"; var assetLoader = InstanceAssetLoader.Load(path); while (!assetLoader.IsCompleted) { yield return(null); } var assetLoader2 = InstanceAssetLoader.Load(path); while (!assetLoader2.IsCompleted) { yield return(null); } assetLoader2.Release(); assetLoader.Release(); KResourceModule.Collect(); }