public IEnumerator LoadAllDependenciesAsync(string fname, int ttl) { if (manifest == null) { LogUtil.Error("manifest == null"); yield break; } string dpname = fname.Replace("\\", "/"); // Get dependecies from the AssetBundleManifest object.. string[] dependencies = manifest.GetAllDependencies(dpname); var length = dependencies.Length; if (length == 0) { yield break; } // Record and load all dependencies. var count = (float)length; for (int i = 0; i < length; i++) { var depend = RemapVariantName(dependencies[i]); LogUtil.Trace(fname + ":dependancy:" + depend); var iter = BundleManager.LoadAsync(fname, depend, ttl); while (iter.MoveNext()) { yield return(null); } } }
public bool CanUnload() { if (assetRequests != null) { foreach (var pair in this.assetRequests) { if (!pair.Value.isDone) { return(false); } } } if (parentBundles != null) { foreach (var pair in this.parentBundles) { var parentBundlePath = pair.Key; var parentBundle = BundleManager.GetBundleRef(parentBundlePath); if (parentBundle != null && !parentBundle.CanUnload()) { return(false); } } } return(true); }
public static void UnloadDeadBundles() { #if PROFILE_FILE Profiler.BeginSample("BundleHelper.UnloadDeadBundles"); #endif BundleManager.UnloadDeadBundles(); #if PROFILE_FILE Profiler.EndSample(); #endif }
public static void UnloadDeadBundles(bool unloadAllLoadedObjects, int iterCount) { #if PROFILE_FILE Profiler.BeginSample("BundleHelper.UnloadDeadBundles"); #endif BundleManager.UnloadDeadBundles(unloadAllLoadedObjects, iterCount); #if PROFILE_FILE Profiler.EndSample(); #endif }
/// <summary> /// Reset the bundle manager /// </summary> public static void Reset() { #if PROFILE_FILE Profiler.BeginSample("BundleHelper.Reset"); #endif BundleConfig.Reset(); BundleManager.Reset(); #if PROFILE_FILE Profiler.EndSample(); #endif }
static public int constructor(IntPtr l) { try { LBoot.BundleManager o; o = new LBoot.BundleManager(); pushValue(l, o); return(1); } catch (Exception e) { return(error(l, e)); } }
public static string[] GetAllDependencies(string uri) { #if PROFILE_FILE Profiler.BeginSample("BundleHelper.GetAllDependencies"); #endif var fixedUri = fixBundleUri(uri); var depends = BundleManager.GetAllDependencies(fixedUri); #if PROFILE_FILE Profiler.EndSample(); #endif return(depends); }
/// <summary> /// Unloads the asset bundle /// </summary> /// <param name="uri">URI.</param> public static void Unload(string uri, bool unloadAllLoadedObjects) { #if PROFILE_FILE Profiler.BeginSample("BundleHelper.Unload"); #endif var fixedUri = fixBundleUri(uri); BundleManager.Unload(fixedUri, unloadAllLoadedObjects); #if PROFILE_FILE Profiler.EndSample(); #endif }
/// <summary> /// Loads the asset bundle with all its dependencies. /// </summary> /// <returns>The with dependencies.</returns> /// <param name="uri">URI.</param> public static AssetBundleRef LoadWithDependencies(string uri, int ttl) { #if PROFILE_FILE Profiler.BeginSample("BundleHelper.LoadWithDependencies"); #endif uri = fixBundleUri(uri); AssetBundleRef bundle = BundleManager.LoadWithDependencies(uri, ttl); #if PROFILE_FILE Profiler.EndSample(); #endif return(bundle); }
static public int GetBundleDependencies(IntPtr l) { try { LBoot.BundleManager self = (LBoot.BundleManager)checkSelf(l); var ret = self.GetBundleDependencies(); pushValue(l, ret); return(1); } catch (Exception e) { return(error(l, e)); } }
/// <summary> /// Load the asset bundle with specified uri. /// </summary> /// <param name="uri">path to the assset bundle </param> public static AssetBundleRef Load(string uri, int ttl) { #if PROFILE_FILE Profiler.BeginSample("BundleHelper.Load"); #endif uri = fixBundleUri(uri); var result = BundleManager.Load(uri, ttl); #if PROFILE_FILE Profiler.EndSample(); #endif return(result); }
private static IEnumerator _LoadWithDependenciesAsync(string uri, int ttl, Action <AssetBundleRef> onComplete) { #if PROFILE_FILE // Profiler.BeginSample("BundleHelper._LoadWithDependenciesAsync"); #endif var fixedUri = fixBundleUri(uri); AssetBundleRef assetBundle = null; var iter = BundleManager.LoadWithDependenciesAsync(fixedUri, ttl); while (iter.MoveNext()) { yield return(null); } assetBundle = BundleManager.GetBundleRef(fixedUri); onComplete(assetBundle); #if PROFILE_FILE // Profiler.EndSample(); #endif }
public static GameObject LoadAndCreate(string name, int ttl) { #if UNITY_EDITOR && LOAD_FROM_EDITOR return(LoadAndCreateInEditor(name, ttl)); #else #if PROFILE_FILE Profiler.BeginSample("BundleHelper.LoadAndCreate"); #endif var uri = fixBundleUri(name); var bundle = BundleManager.LoadWithDependencies(uri, ttl); var assetName = getAssetName(name); var go = bundle.LoadAsset(assetName) as GameObject; var result = GameObject.Instantiate(go); #if PROFILE_FILE Profiler.EndSample(); #endif return(result); #endif }
public void LoadAllDependencies(string fname, int ttl) { if (manifest == null) { LogUtil.Error("manifest==null"); return; } #if PROFILE_FILE Profiler.BeginSample("BundleDependencies.LoadAllDependencies"); #endif string dpname = fname.Replace("\\", "/"); // int idx = dpname.LastIndexOf("/") + 1; // dpname = dpname.Substring(idx, dpname.Length - idx); // Get dependecies from the AssetBundleManifest object.. string[] dependencies = manifest.GetAllDependencies(dpname); var length = dependencies.Length; if (length == 0) { return; } // Record and load all dependencies. for (int i = 0; i < length; i++) { var depend = RemapVariantName(dependencies[i]); LogUtil.Trace(fname + ":dependancy:" + depend); var bundle = BundleManager.Load(depend, ttl); if (bundle != null) { bundle.AddParentBundle(fname); } } #if PROFILE_FILE Profiler.EndSample(); #endif }
private static IEnumerator _LoadLevelAdditiveAsync(string uri, int ttl, Action onComplete, Action <AsyncLoadingType, float> onProgress = null) { #if PROFILE_FILE // Profiler.BeginSample("BundleHelper.LoadLevelAdditiveAsync"); #endif var fixedUri = fixBundleUri(uri); #if !UNITY_EDITOR || !LOAD_FROM_EDITOR AssetBundleRef assetBundle = null; var iter = BundleManager.LoadWithDependenciesAsync(fixedUri, ttl, bundle => assetBundle = bundle); while (iter.MoveNext()) { if (onProgress != null) { onProgress(AsyncLoadingType.AssetBundle, (float)iter.Current); } yield return(null); } #endif var asyncOp2 = Application.LoadLevelAdditiveAsync(getAssetName(uri)); while (!asyncOp2.isDone) { if (onProgress != null) { onProgress(AsyncLoadingType.Scene, asyncOp2.progress); } yield return(null); } yield return(new WaitForEndOfFrame()); onComplete(); #if PROFILE_FILE // Profiler.EndSample(); #endif }
private static IEnumerator _LoadWithDependenciesAsync(string uri, int ttl, LuaTable lua) { #if PROFILE_FILE // Profiler.BeginSample("BundleHelper._LoadWithDependenciesAsync"); #endif var fixedUri = fixBundleUri(uri); AssetBundleRef assetBundle = null; var iter = BundleManager.LoadWithDependenciesAsync(fixedUri, ttl); int count = 0; while (iter.MoveNext()) { count++; yield return(null); } assetBundle = BundleManager.GetBundleRef(fixedUri); if (lua != null) { lua.setOneLevelField("bundle", assetBundle); } #if PROFILE_FILE // Profiler.EndSample(); #endif }
public static void SetBundleVariants(string[] variants) { BundleManager.SetBundleVariantes(variants); }
public static string GetRealBundlePath(string uri) { var fixedUri = fixBundleUri(uri); return(BundleManager.RemapVariantBundleName(fixedUri)); }