Exemplo n.º 1
0
        void OnGUI()
        {
            if (!downloading)
            {
                GUILayout.Space(20);
                GUILayout.BeginHorizontal();
                GUILayout.Space(20);
                GUILayout.BeginVertical();
                if (GUILayout.Button("Clear persistentDataPath"))
                {
#if UNITY_2017_1_OR_NEWER
                    Caching.ClearCache();
#else
                    Caching.CleanCache();
#endif
                    BundleUtil.ClearStorableDirectory();
                }
#if UNITY_EDITOR
                if (GUILayout.Button("Remove StreamingAssets"))
                {
                    if (Directory.Exists(BundleUtil.GetReadOnlyDirectory()))
                    {
                        Directory.Delete(BundleUtil.GetReadOnlyDirectory(), true);
                    }
                    UnityEditor.AssetDatabase.Refresh();
                }
#endif
                GUILayout.Space(5);
                if (GUILayout.Button("Download AssetBundle"))
                {
                    StartCoroutine(Download());
                }

                if (GUILayout.Button("Load an asset"))
                {
                    if (!File.Exists(BundleUtil.GetStorableDirectory() + BundleSetting.ManifestFilename))
                    {
                        Debug.LogFormat("Please download assetbundles first,try again.");
                    }
                    else
                    {
                        this.LoadAsset("LoxodonFramework/BundleExamples/Models/Red/Red.prefab");
                    }
                }
                GUILayout.EndVertical();
                GUILayout.EndHorizontal();
            }
        }