UnloadAssetBundle() static public method

static public UnloadAssetBundle ( string assetBundleName ) : void
assetBundleName string
return void
        IEnumerator <YieldInstruction> InitializeAndThenLoadSceneIntoLevel(string assetBundleName, string sceneName)
        {
#if DLK_AssetBundleIntegrationEnabled
            initialized = true;

            if (variantPossibilities != null && variantPossibilities.Length > 0)
            {
                SetVariant(activeVariant);
            }
            else
            {
                variantPossibilities = null;
                activeVariant        = null;
            }

            AssetBundleManager.logMode = logMode == AssetBundleManagerLogMode.All ? AssetBundleManager.LogMode.All : AssetBundleManager.LogMode.JustErrors;

            if (streamingType == StreamingType.SimulationModeOrLocalAssetServer)
            {
                AssetBundleManager.SetDevelopmentAssetBundleServer();
            }
            else if (streamingType == StreamingType.StreamingAssetsFolder)
            {
                AssetBundleManager.SetSourceAssetBundleURL("file:///" + Application.streamingAssetsPath + "/");
            }
            else
            {
                AssetBundleManager.SetSourceAssetBundleURL(serverURL);
            }

            // Initialize AssetBundleManifest which loads the AssetBundleManifest object.
            var initializeRequest = AssetBundleManager.Initialize();

            if (initializeRequest != null)
            {
                while (initializeRequest.MoveNext())
                {
                    yield return(null);
                }
            }

            AssetBundleLoadOperation levelLoadRequest = AssetBundleManager.LoadLevelAsync(assetBundleName, sceneName, true);

            if (levelLoadRequest != null)
            {
                while (levelLoadRequest.MoveNext())
                {
                    yield return(null);//request.Current just returns null, so we can do that instead
                }
                AssetBundleManager.UnloadAssetBundle(assetBundleName);
            }
            else
            {
                Debug.Log("Could not load level " + assetBundleName + " Asset Bundle.");
                yield break;
            }
#else
            throw new NotImplementedException("You must enable Asset Bundle Integration to utilize the Asset Bundle Loader.");
#endif
        }
Beispiel #2
0
    public void LoadSprite(bool isFront, string bundleName, string assetName)
    {
        AssetBundleLoadAssetOperation loadAssetOperation = AssetBundleManager.LoadAsset(bundleName, assetName, typeof(Sprite), (string)null);
        Sprite asset1 = loadAssetOperation.GetAsset <Sprite>();

        if (Object.op_Equality((Object)asset1, (Object)null))
        {
            Texture2D asset2 = loadAssetOperation.GetAsset <Texture2D>();
            asset1 = Sprite.Create(asset2, new Rect(0.0f, 0.0f, (float)((Texture)asset2).get_width(), (float)((Texture)asset2).get_height()), Vector2.get_zero());
        }
        if (isFront)
        {
            this.front.filter.set_sprite(asset1);
            if (!this.frontImageAssetBundleName.IsNullOrEmpty())
            {
                AssetBundleManager.UnloadAssetBundle(this.frontImageAssetBundleName, false, (string)null, false);
            }
            this.frontImageAssetBundleName = bundleName;
        }
        else
        {
            this.back.filter.set_sprite(asset1);
            if (!this.backImageAssetBundleName.IsNullOrEmpty())
            {
                AssetBundleManager.UnloadAssetBundle(this.backImageAssetBundleName, false, (string)null, false);
            }
            this.backImageAssetBundleName = bundleName;
        }
    }
    public void unLoadAssetBundleManager()
    {
        AssetBundleManager.UnloadAssetBundle(assetBundleName);
        GameObject assetBundleManager = GameObject.Find("AssetBundleManager");

        AssetBundleManager.DestroyObject(assetBundleManager);
    }
    // Use this for initialization
    IEnumerator Start()
    {
        // マニフェストファイルのロード
        yield return(StartCoroutine(DownloadManifest()));

        _loadedObjectList = new List <GameObject>();

        foreach (var path in downloadABList)
        {
            yield return(StartCoroutine(Load(path, "Cat")));

            // AssetBundleのアンロード
            AssetBundleManager.UnloadAssetBundle(path);
        }

        // ロード済みなので使用可能
        int i = 0;

        foreach (var prefab in _loadedObjectList)
        {
            var go = Instantiate(prefab);
            go.transform.localPosition = catPosList[i];
            // shader再設定
            ShaderFind(go);
            i++;
        }

        Destroy(gameObject, 1f);
    }
Beispiel #5
0
    IEnumerator Start()
    {
        if (!Caching.enabled)
        {
            Debug.LogError("対応端末ではありません。");
            yield break;
        }

        while (!Caching.ready)
        {
            yield return(null);
        }

        Caching.maximumAvailableDiskSpace = RequiredDiskSpaceByte;
        DownloadProgresSlider.maxValue    = 1;

        ObservableAssetBundle.Initialize()
        .Subscribe(_ => ObservableAssetBundle.LoadAssetBundle <AudioClip>(AssetBundlePath, AssetName, this)
                   .Subscribe(clip =>
        {
            DownloadProgresSlider.value = 1;
            DonwloadStatusText.text     = "BGMダウンロード完了";

            BgmAudioSource.clip = clip;
            BgmAudioSource.outputAudioMixerGroup = Mixer.FindMatchingGroups("BGM").FirstOrDefault();
            BgmAudioSource.Play();

            AssetBundleManager.UnloadAssetBundle(AssetBundlePath);
        }));
    }
        public static List <ExcelData.Param> LoadExcelData(
            string assetBunndlePath,
            string assetName,
            int cellS,
            int rowS)
        {
            if (!AssetBundleCheck.IsFile(assetBunndlePath, assetName))
            {
                OutputLog.Error(string.Format("ExcelData:{0}がない", (object)assetName), false, "Log");
                return((List <ExcelData.Param>)null);
            }
            AssetBundleLoadAssetOperation loadAssetOperation = AssetBundleManager.LoadAsset(assetBunndlePath, assetName, typeof(ExcelData), (string)null);

            AssetBundleManager.UnloadAssetBundle(assetBunndlePath, true, (string)null, false);
            if (loadAssetOperation.IsEmpty())
            {
                OutputLog.Error(string.Format("ExcelData:{0}がない?", (object)assetName), false, "Log");
                return((List <ExcelData.Param>)null);
            }
            ExcelData asset = loadAssetOperation.GetAsset <ExcelData>();
            int       cell  = asset.MaxCell - 1;
            int       row   = asset.list[cell].list.Count - 1;

            return(asset.Get(new ExcelData.Specify(cellS, rowS), new ExcelData.Specify(cell, row)));
        }
Beispiel #7
0
    void OnGUI()
    {
        if (GUI.Button(new Rect(100, 50, 100, 50), "Load Scene"))
        {
            // Load level.
            StartCoroutine(LoadLevel("scene.unity3d", "testScene", loadLevelAdditive));
            // Unload assetBundles.
            // AssetBundleManager.UnloadAssetBundle("scene.unity3d");
        }

        if (GUI.Button(new Rect(300, 50, 100, 50), "Load Main"))
        {
            SceneManager.LoadScene("SceneLoader");
            // Load level.
            // StartCoroutine(LoadLevel ("scene.unity3d", "testScene", loadLevelAdditive) );
            // Unload assetBundles.
            // AssetBundleManager.UnloadAssetBundle("scene.unity3d");
        }

        if (GUI.Button(new Rect(100, 180, 100, 50), "UnLoad Scene"))
        {
            // Unload assetBundles.
            AssetBundleManager.UnloadAssetBundle("scene.unity3d");
        }
    }
Beispiel #8
0
 void _playerDataLoaded(params object[] args)
 {
     AssetBundleLoader.Instance().LoadLevelAsset("home", () =>
     {
         AssetBundleManager.UnloadAssetBundle("assets/abres/scene/updater", true);
     });
 }
    public void LoadPresets()
    {
        string path = this.saveDir + "ColorPresets.json";

        if (!File.Exists(path))
        {
            TextAsset textAsset = CommonLib.LoadAsset <TextAsset>("custom/colorsample.unity3d", "ColorPresets", false, string.Empty);
            if (!Object.op_Inequality((Object)null, (Object)textAsset))
            {
                return;
            }
            this.colorInfo = (UI_ColorPresets.ColorInfo)JsonUtility.FromJson <UI_ColorPresets.ColorInfo>(textAsset.get_text());
            AssetBundleManager.UnloadAssetBundle("custom/colorsample.unity3d", true, (string)null, false);
            this.SavePresets();
        }
        else
        {
            this.colorInfo = (UI_ColorPresets.ColorInfo)JsonUtility.FromJson <UI_ColorPresets.ColorInfo>(File.ReadAllText(path));
            if (this.colorInfo.lstColorSample.Count != 0)
            {
                return;
            }
            TextAsset textAsset = CommonLib.LoadAsset <TextAsset>("custom/colorsample.unity3d", "ColorPresets", false, string.Empty);
            if (!Object.op_Inequality((Object)null, (Object)textAsset))
            {
                return;
            }
            UI_ColorPresets.ColorInfo colorInfo = (UI_ColorPresets.ColorInfo)JsonUtility.FromJson <UI_ColorPresets.ColorInfo>(textAsset.get_text());
            AssetBundleManager.UnloadAssetBundle("custom/colorsample.unity3d", true, (string)null, false);
            this.colorInfo.lstColorSample = new List <Color>((IEnumerable <Color>)colorInfo.lstColorSample);
            this.SavePresets();
        }
    }
Beispiel #10
0
    IEnumerator AsyncLoad(string sceneName)
    {
        yield return(StartCoroutine(BaseLoader.Instance.LoadLevel("scenario/" + sceneName, sceneName, false)));

        // Unload assetBundles.
        AssetBundleManager.UnloadAssetBundle("scenario/" + sceneName);
    }
Beispiel #11
0
    private IEnumerator StartLoadLevel(string assetBundleName, string levelName)
    {
        if (!string.IsNullOrEmpty(this.m_currentLevel))
        {
            AssetBundleManager.UnloadAssetBundle(this.m_currentLevel, true);
        }
        yield return(new WaitForEndOfFrame());

#if DEBUG_ASSETBUNDLE
        Debug.Log("---------");
#endif
        SceneManager.LoadScene("empty");
        yield return(new WaitForEndOfFrame());

#if DEBUG_ASSETBUNDLE
        Debug.Log("--- load level asy ---");
#endif
        AssetBundleLoadOperation level = AssetBundleManager.LoadLevelAsync(assetBundleName, levelName);
        yield return(level);

        this.m_currentLevel = assetBundleName;
        if (this.mLoadLevelCallback != null)
        {
            this.mLoadLevelCallback();
            this.mLoadLevelCallback = null;
        }
    }
Beispiel #12
0
        public static string FindADVBundleFilePath(string path, string asset, out ScenarioData data)
        {
            data = (ScenarioData)null;
            string str = (string)null;

            foreach (string assetBundleName in (IEnumerable <string>)CommonLib.GetAssetBundleNameListFromPath(string.Format("adv/scenario/{0}/ ", (object)path), true).OrderByDescending <string, string>((Func <string, string>)(bundle => bundle)))
            {
                if (asset == null)
                {
                    str = assetBundleName;
                }
                else
                {
                    foreach (ScenarioData allAsset in AssetBundleManager.LoadAllAsset(assetBundleName, typeof(ScenarioData), (string)null).GetAllAssets <ScenarioData>())
                    {
                        if (((Object)allAsset).get_name() == asset)
                        {
                            str  = assetBundleName;
                            data = allAsset;
                            break;
                        }
                    }
                    AssetBundleManager.UnloadAssetBundle(assetBundleName, false, (string)null, false);
                }
                if (str != null)
                {
                    break;
                }
            }
            return(str);
        }
 public static List <string> LoadAllListTextFromList(
     string _assetbundleFolder,
     string _strLoadFile,
     ref List <string> lst,
     List <string> _OmitFolderName = null)
 {
     GlobalMethod.lstABName.Clear();
     GlobalMethod.lstABName = GlobalMethod.GetAssetBundleNameListFromPath(_assetbundleFolder, false);
     GlobalMethod.lstABName.Sort();
     for (int index = 0; index < GlobalMethod.lstABName.Count; ++index)
     {
         string stringRight = YS_Assist.GetStringRight(Path.GetFileNameWithoutExtension(GlobalMethod.lstABName[index]), 2);
         if (_OmitFolderName == null || !_OmitFolderName.Contains(stringRight))
         {
             if (GlobalMethod.AssetFileExist(GlobalMethod.lstABName[index], _strLoadFile, string.Empty))
             {
                 TextAsset textAsset = CommonLib.LoadAsset <TextAsset>(GlobalMethod.lstABName[index], _strLoadFile, false, string.Empty);
                 AssetBundleManager.UnloadAssetBundle(GlobalMethod.lstABName[index], true, (string)null, false);
                 if (!Object.op_Equality((Object)textAsset, (Object)null))
                 {
                     lst.Add(textAsset.get_text());
                 }
             }
         }
     }
     return(lst);
 }
Beispiel #14
0
        /// <summary>
        /// Change female animation/position
        /// </summary>
        /// <param name="path"></param>
        /// <param name="name"></param>
        private IEnumerator ChangeMotion(string path, string name)
        {
            PushLimbAutoAttachButton(true);

            if (femaleSpinePos == null)
            {
                femaleSpinePos = new GameObject("femaleSpinePos");
            }
            femaleSpinePos.transform.position = femaleBase.transform.position;
            femaleSpinePos.transform.rotation = femaleBase.transform.rotation;

            CtrlState oldState = currentCtrlstate;

            currentCtrlstate = CtrlState.Following;

            Animator component = female_p_cf_bodybone.GetComponent <Animator>();
            RuntimeAnimatorController  runtimeAnimatorController  = CommonLib.LoadAsset <RuntimeAnimatorController>(path, name, false, string.Empty);
            AnimatorOverrideController animatorOverrideController = new AnimatorOverrideController(component.runtimeAnimatorController);

            foreach (AnimationClip animationClip in new AnimatorOverrideController(runtimeAnimatorController).animationClips)
            {
                animatorOverrideController[animationClip.name] = animationClip;
            }
            animatorOverrideController.name     = runtimeAnimatorController.name;
            component.runtimeAnimatorController = animatorOverrideController;
            AssetBundleManager.UnloadAssetBundle(path, true, null, false);

            for (int k = 0; k < 2; k++)
            {
                yield return(null);
            }
            currentCtrlstate = oldState;
            yield break;
        }
Beispiel #15
0
    IEnumerator m_LoadAsset <T>(string assetbundleName, string assetName, Action <T> callBack) where T : UnityEngine.Object
    {
        if (callBack == null)
        {
            yield break;
        }
        assetbundleName = assetbundleName.ToLower();
        string assetKey = string.Concat(assetbundleName, "_", assetName);

        if (assets.ContainsKey(assetKey))
        {
            callBack(assets[assetKey] as T);
            yield break;
        }
        var type    = typeof(T);
        var request = AssetBundleManager.LoadAssetAsync(assetbundleName, assetName, type);

        if (request == null)
        {
            yield break;
        }
        while (!request.IsDone())
        {
            yield return(null);
        }
        assets[assetKey] = request.GetAsset <T>();
        callBack(assets[assetKey] as T);
        AssetBundleManager.UnloadAssetBundle(assetbundleName);
    }
        public override void Do()
        {
            base.Do();
            int num1 = 0;

            string[] args1  = this.args;
            int      index1 = num1;
            int      num2   = index1 + 1;

            this.no = int.Parse(args1[index1]);
            string[] args2           = this.args;
            int      index2          = num2;
            int      num3            = index2 + 1;
            string   assetBundleName = args2[index2];

            string[]  args3     = this.args;
            int       index3    = num3;
            int       num4      = index3 + 1;
            string    assetName = args3[index3];
            TextAsset ta        = CommonLib.LoadAsset <TextAsset>(assetBundleName, assetName, false, string.Empty);

            if (Object.op_Inequality((Object)ta, (Object)null))
            {
                ChaControl chaCtrl = this.scenario.commandController.GetChara(this.no).chaCtrl;
                chaCtrl.nowCoordinate.LoadFile(ta);
                chaCtrl.Reload(false, true, true, true, true);
            }
            AssetBundleManager.UnloadAssetBundle(assetBundleName, true, (string)null, false);
        }
    public static string LoadAllListText(List <string> _lstAssetBundleNames, string _strLoadFile)
    {
        StringBuilder stringBuilder = new StringBuilder();

        for (int index1 = 0; index1 < _lstAssetBundleNames.Count; ++index1)
        {
            string[] allAssetName = AssetBundleCheck.GetAllAssetName(_lstAssetBundleNames[index1], false, (string)null, false);
            bool     flag         = false;
            for (int index2 = 0; index2 < allAssetName.Length; ++index2)
            {
                if (allAssetName[index2].Compare(_strLoadFile, true))
                {
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                GlobalMethod.DebugLog("[" + _lstAssetBundleNames[index1] + "][" + _strLoadFile + "]は見つかりません", 1);
            }
            else
            {
                TextAsset textAsset = CommonLib.LoadAsset <TextAsset>(_lstAssetBundleNames[index1], _strLoadFile, false, string.Empty);
                AssetBundleManager.UnloadAssetBundle(_lstAssetBundleNames[index1], true, (string)null, false);
                if (!Object.op_Equality((Object)textAsset, (Object)null))
                {
                    stringBuilder.Append(textAsset.get_text());
                }
            }
        }
        return(stringBuilder.ToString());
    }
Beispiel #18
0
            public new T Pop()
            {
                T obj1 = base.Pop();

                if (this.nowSceneNameList.Any <string>())
                {
                    this.nowSceneNameList.Pop <string>();
                }
                if (!this.nowSceneNameList.Any <string>())
                {
                    foreach (T obj2 in (Stack <T>) this)
                    {
                        this.nowSceneNameList.Add(obj2.levelName);
                        if (!obj2.isAdd)
                        {
                            break;
                        }
                    }
                }
                AssetBundleManager.UnloadAssetBundle(obj1.assetBundleName, false, obj1.manifestFileName, false);
                Debug.LogFormat("Pop Scene\nlevelName:{0}\nisAdd:{1}\nisAsync:{2}\nassetBundleName:{3}", new object[4]
                {
                    (object)obj1.levelName,
                    (object)obj1.isAdd,
                    (object)obj1.isAsync,
                    (object)obj1.assetBundleName
                });
                return(obj1);
            }
    IEnumerator CreateCardEnumrator(string typeName, string fileName, Image sprImg)
    {
        while (AssetBundleManager.AssetBundleManifestObject == null)
        {
            yield return(null);
        }

        string assetBundleName = "assets/jewel-s-free101j/image/" + typeName + "/" + fileName + ".png";
        string assetName       = fileName;
        AssetBundleLoadAssetOperation request;

        // Load asset from assetBundle.
        request = AssetBundleManager.LoadAssetAsync(assetBundleName, assetName, typeof(Texture2D));
        if (request == null)
        {
            yield break;
        }
        webCoroutine = StartCoroutine(request);
        yield return(webCoroutine);

        webCoroutine = null;

        Texture2D tex = request.GetAsset <Texture2D>();
        Sprite    spr = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), Vector2.zero, 1.0f);

        spr.name = tex.name;
        AssetBundleManager.UnloadAssetBundle(assetBundleName);
        sprImg.sprite = spr;
    }
Beispiel #20
0
 public void CreateBoneList(GameObject obj, string assetBundleName, string assetName)
 {
     this.dictBone.Clear();
     if (!AssetBundleCheck.IsFile(assetBundleName, assetName))
     {
         Debug.LogWarning((object)("読み込みエラー\r\nassetBundleName:" + assetBundleName + "\tassetName:" + assetName));
     }
     else
     {
         AssetBundleLoadAssetOperation loadAssetOperation = AssetBundleManager.LoadAsset(assetBundleName, assetName, typeof(TextAsset), (string)null);
         if (loadAssetOperation.IsEmpty())
         {
             Debug.LogError((object)("読み込みエラー\r\nassetName:" + assetName));
         }
         else
         {
             string[,] data;
             YS_Assist.GetListString(loadAssetOperation.GetAsset <TextAsset>().get_text(), out data);
             int length1 = data.GetLength(0);
             int length2 = data.GetLength(1);
             if (length1 != 0 && length2 != 0)
             {
                 for (int index = 0; index < length1; ++index)
                 {
                     GameObject loop = obj.get_transform().FindLoop(data[index, 0]);
                     if (Object.op_Implicit((Object)loop))
                     {
                         this.dictBone[data[index, 0]] = loop;
                     }
                 }
             }
             AssetBundleManager.UnloadAssetBundle(assetBundleName, true, (string)null, false);
         }
     }
 }
Beispiel #21
0
 private void OnSceneUnloaded(Scene scene)
 {
     if (m_LoadedScenesAssetBundle.ContainsKey(scene.name))
     {
         AssetBundleManager.UnloadAssetBundle(m_LoadedScenesAssetBundle[scene.name]);
         m_LoadedScenesAssetBundle.Remove(scene.name);
     }
 }
Beispiel #22
0
 protected virtual void OnDestroy()
 {
     if (!this.isLoadEnd || !this.isBundleUnload || !Singleton <AssetBundleManager> .IsInstance())
     {
         return;
     }
     AssetBundleManager.UnloadAssetBundle(this.assetBundleName, this.isUnloadForceRefCount, this.manifestFileName, this.unloadAllLoadedObjects);
 }
Beispiel #23
0
    protected static IEnumerator LoadAutoUnload(string assetBundleName, string assetName, Action <UnityEngine.Object> callback)
    {
        yield return(ms_Instance.Load(assetBundleName, assetName, callback));

        yield return(new WaitForSeconds(BUNDLE_HOLD_SECONDS));

        AssetBundleManager.UnloadAssetBundle(assetBundleName);
    }
Beispiel #24
0
        public static Root Load(Transform parent)
        {
            string assetBundleName = "adv/root.unity3d";
            AssetBundleLoadAssetOperation loadAssetOperation = AssetBundleManager.LoadAsset(assetBundleName, "ADV_Root", typeof(GameObject), (string)null);

            AssetBundleManager.UnloadAssetBundle(assetBundleName, false, (string)null, false);
            return((Root)((GameObject)Object.Instantiate <GameObject>((M0)loadAssetOperation.GetAsset <GameObject>(), parent, false)).GetComponent <Root>());
        }
 public override void UnloadAssetBundle()
 {
     if (!unloaded)
     {
         AssetBundleManager.UnloadAssetBundle(assetBundleName);
         unloaded = true;
     }
 }
        public static T LoadAsset <T>(string assetbundleName, string assetName, string manifestName = "") where T : Object
        {
            manifestName = !manifestName.IsNullOrEmpty() ? manifestName : (string)null;
            T obj = CommonLib.LoadAsset <T>(assetbundleName, assetName, false, manifestName);

            AssetBundleManager.UnloadAssetBundle(assetbundleName, true, manifestName, false);
            return(obj);
        }
 public virtual void UnloadBundle(bool isUnloadForceRefCount = false, bool unloadAllLoadedObjects = false)
 {
     if (this.request != null)
     {
         AssetBundleManager.UnloadAssetBundle(this, isUnloadForceRefCount, unloadAllLoadedObjects);
     }
     this.request = (AssetBundleLoadAssetOperation)null;
 }
Beispiel #28
0
 public void CleanUp()
 {
     foreach (string key in _cachePrefabs.Keys)
     {
         AssetBundleManager.UnloadAssetBundle(key, true);
     }
     _cachePrefabs.Clear();
 }
Beispiel #29
0
 public override void Result(bool processEnd)
 {
     if (this.fade._Fade == SimpleFade.Fade.Out && !this.assetBundleName.IsNullOrEmpty())
     {
         AssetBundleManager.UnloadAssetBundle(this.assetBundleName, true, (string)null, false);
     }
     this.fade._Time = this.bkFadeTime;
     this.fade.ForceEnd();
 }
Beispiel #30
0
    public void unLoadAssetBundleManager()
    {
        AssetBundleManager.UnloadAssetBundle(assetBundleName);
        AssetBundleManager.UnloadAssetBundle(assetBundleName + ".mf");
        //DebugOnScreen.Log("upload AB "+ assetBundleName + ".mf");
        GameObject assetBundleManager = GameObject.Find("AssetBundleManager");

        AssetBundleManager.DestroyObject(assetBundleManager);
    }