public IEnumerator LoadingGameSceneLevelAdditive(string packageName, string sceneName) { if (SceneLevelDownloader != null) { Debug.LogError("have other scene loader!"); yield break; } SceneLevelDownloader = AllocResourcesDownLoader_DontDestroyOnLoad(); yield return(StartCoroutine(SceneLevelDownloader.DownloadPackage(packageName))); Application.LoadLevelAdditive(sceneName); ReleaseResourcesDownLoader(SceneLevelDownloader); SceneLevelDownloader = null; }
public IEnumerator LoadingAssetObject(string packageName, string assetName, uint assetGuid, Type type, bool isInstantiate) { UniGameResourcesDownLoader loader = AllocResourcesDownLoader_DontDestroyOnLoad(); yield return(StartCoroutine(loader.DownloadPackage(packageName))); UniGameResourcesPackage package = UniGameResources.FindSystemResourcesPackageTable(packageName); if (package == null) { Debug.LogError(string.Format("not find package:{0}", packageName)); yield break; } UnityEngine.Object obj = null; package.LockPackage(); try { if (isInstantiate) { #if UNITY_4_3 || UNITY_4_6 obj = GameObject.Instantiate(package.currentAssetBundle.Load(assetName, type)); #else obj = GameObject.Instantiate(package.currentAssetBundle.LoadAsset(assetName, type)); #endif } else { #if UNITY_4_3 || UNITY_4_6 obj = package.currentAssetBundle.Load(assetName, type); #else obj = package.currentAssetBundle.LoadAsset(assetName, type); #endif } } catch (System.Exception ex) { Debug.LogError(ex.ToString()); } package.UnLockPackage(); loadingAssetTree.Add(assetGuid, obj); ReleaseResourcesDownLoader(loader); }