private async void InnerLoadSceneAsync(string sceneName, AssetLoadFinishedEventHandler <SceneInstance> callback, LoadSceneMode mode, bool bCheck = true) { try { this.m_oLoadSceneOperation = Addressables.LoadSceneAsync(sceneName, mode); var scene = await this.m_oLoadSceneOperation.Task; if (bCheck) { this.CheckFinishedLoad(); this.StartLoadTaskAsset(); } callback?.Invoke(scene); } catch (Exception e) { Debug.LogException(e); } }
//public void LoadAsset<T>(string assetName, AssetLoadFinishedEventHandler<T> callback)where T:Object //{ // //this.m_eCurAssetType = EAssetType.Asset; // //this.LoadAsssetAsync<T>(assetName, callback,false); // this.AddAssetTask<T>(assetName, callback); //} //private async void LoadAsssetAsync<T>(string assetName, AssetLoadFinishedEventHandler<T> callback,bool bCheck = true) where T : Object //{ // try // { // this.m_oLoadObjectOperation = Addressables.LoadAssetAsync<Object>(assetName); // var obj = await this.m_oLoadObjectOperation.Task as T; // if (bCheck) // { // this.CheckFinishedLoad(); // this.StartLoadTaskAsset(); // } // callback?.Invoke(obj); // } // catch (Exception e) // { // Debug.LogException(e); // } //} private async void LoadAsssetAsync(string assetName, AssetLoadFinishedEventHandler <Object> callback, bool bCheck = true) { try { this.m_oLoadObjectOperation = Addressables.LoadAssetAsync <Object>(assetName); var obj = await this.m_oLoadObjectOperation.Task; if (bCheck) { this.CheckFinishedLoad(); this.StartLoadTaskAsset(); } callback?.Invoke(obj); } catch (Exception e) { Debug.LogException(e); } }
private async void LoadGameObjectAsyn(string objPath, AssetLoadFinishedEventHandler <GameObject> callback, bool bCheck = true) { try { this.m_oLoadGameObjectOperation = Addressables.InstantiateAsync(objPath, Vector3.zero, Quaternion.identity); var obj = await this.m_oLoadGameObjectOperation.Task; //Debug.Log(objPath); if (bCheck) { this.CheckFinishedLoad(); this.StartLoadTaskAsset(); } callback?.Invoke(obj); } catch (Exception e) { Debug.LogException(e); } }