Esempio n. 1
0
        private static void ClearPackingTagAndAssetBundle()
        {
            List <string> bundlePaths = EditorResHelper.GetAllResourcePath("Assets/AssetBundles/", true);

            foreach (string bundlePath in bundlePaths)
            {
                AssetImporter importer = AssetImporter.GetAtPath(bundlePath);
                if (importer == null)
                {
                    continue;
                }
                //Log.Info(bundlePath);
                importer.assetBundleName = "";
            }

            //List<string> paths = EditorResHelper.GetAllResourcePath("Assets/Res", true);
            //foreach (string pt in paths)
            //{
            //	string extendName = Path.GetExtension(pt);
            //	if (extendName == ".cs")
            //	{
            //		continue;
            //	}

            //	AssetImporter importer = AssetImporter.GetAtPath(pt);
            //	if (importer == null)
            //	{
            //		continue;
            //	}
            //	//Log.Info(bundlePath);
            //	importer.assetBundleName = "";

            //	SetAtlas(pt, "");
            //}
        }
Esempio n. 2
0
        static void InitEffect()
        {
            List <string> tmpPaths = EditorResHelper.GetAllResourcePath(Effect_Path, false);

            foreach (string path in tmpPaths)
            {
                string     tmpPath = path.Replace('\\', '/');
                GameObject tmpGo   = AssetDatabase.LoadAssetAtPath <GameObject>(tmpPath);

                if (null == tmpGo)
                {
                    continue;
                }

                EffectRecord tmpEffectRecord = tmpGo.GetComponent <EffectRecord>();

                if (null == tmpEffectRecord)
                {
                    tmpEffectRecord = tmpGo.AddComponent <EffectRecord>();
                }

                tmpEffectRecord.Init();
                EditorUtility.SetDirty(tmpGo);
            }

            AssetDatabase.Refresh();
        }
Esempio n. 3
0
        private static void ClearPackingTagAndAssetBundle(string path)
        {
            List <string> tmpResList = EditorResHelper.GetAllResourcePath(path, true);

            foreach (string pt in tmpResList)
            {
                if (Path.GetExtension(pt).Equals(".cs"))
                {
                    continue;
                }

                AssetImporter tmpImporter = AssetImporter.GetAtPath(pt);

                if (tmpImporter == null)
                {
                    continue;
                }

                tmpImporter.assetBundleName = "";

                if (tmpImporter is TextureImporter)
                {
                    (tmpImporter as TextureImporter).spritePackingTag = "";
                }
            }
        }
Esempio n. 4
0
        private static void ClearPackingTagAndAssetBundle()
        {
            List <string> paths = EditorResHelper.GetAllResourcePath("Assets/Res", true);

            foreach (string path in paths)
            {
                SetBundleAndAtlas(path, string.Empty, true);
            }
        }
Esempio n. 5
0
        // 目录下每个prefab打个包,分析共享资源,共享资源打个包
        private void SetShareBundleAndAtlas(string dir)
        {
            List <string> paths = EditorResHelper.GetAllResourcePath(dir, true);

            foreach (string path in paths)
            {
                string path1 = path.Replace('\\', '/');
                Object go    = AssetDatabase.LoadAssetAtPath <Object>(path1);

                SetBundle(path1, go.name);

                List <string> pathes = CollectDependencies(path1);
                foreach (string pt in pathes)
                {
                    string extension = Path.GetExtension(pt);
                    if (extension == ".cs" || extension == ".dll")
                    {
                        continue;
                    }
                    //if (pt.Contains("Resources"))
                    //{
                    //	continue;
                    //}
                    if (pt == path1)
                    {
                        continue;
                    }

                    // 不存在则记录下来
                    if (!this.dictionary.ContainsKey(pt))
                    {
                        Debug.Log($"{path1}----{pt}");
                        BundleInfo bundleInfo = new BundleInfo();
                        bundleInfo.ParentPaths.Add(path1);
                        this.dictionary.Add(pt, bundleInfo);

                        SetAtlas(pt, go.name);

                        continue;
                    }

                    // 依赖的父亲不一样
                    BundleInfo info = this.dictionary[pt];
                    if (info.ParentPaths.Contains(path1))
                    {
                        continue;
                    }
                    info.ParentPaths.Add(path1);

                    //DirectoryInfo dirInfo = new DirectoryInfo(dir);
                    //string dirName = dirInfo.Name;

                    SetBundleAndAtlas(pt, $"{Path.GetFileNameWithoutExtension(pt)}_share");
                }
            }
        }
Esempio n. 6
0
    private static void SetBundleHumanTexture(string dir, bool subDir = true)
    {
        List <string> paths = EditorResHelper.GetAllResourcePath(dir, subDir);

        foreach (string path in paths)
        {
            string path1 = path.Replace('\\', '/');
            Object go    = AssetDatabase.LoadAssetAtPath <Object>(path1);
            SetBundle(path1, go.name, true);
        }
    }
Esempio n. 7
0
        private static void ClearPackingTagAndAssetBundle()
        {
            List <string> bundlePaths = EditorResHelper.GetAllResourcePath("Assets/Bundles/", true);

            foreach (string bundlePath in bundlePaths)
            {
                AssetImporter importer = AssetImporter.GetAtPath(bundlePath);
                if (importer == null)
                {
                    continue;
                }
                //Log.Info(bundlePath);
                importer.assetBundleName = "";
            }

            List <string> paths = EditorResHelper.GetAllResourcePath("Assets/Res", true);

            foreach (string path in paths)
            {
                string extendName = Path.GetExtension(path);
                if (extendName == ".cs")
                {
                    continue;
                }

                AssetImporter importer = AssetImporter.GetAtPath(path);
                if (importer == null)
                {
                    continue;
                }

                //Log.Info(path);

                importer.assetBundleName = "";

                TextureImporter textureImporter = importer as TextureImporter;
                if (textureImporter != null)
                {
                    textureImporter.spritePackingTag = "";
                }
            }
        }
Esempio n. 8
0
    private static void ClearPackingTagAndAssetBundle()
    {
        List <string> bundlePaths = EditorResHelper.GetAllResourcePath("Assets/Bundles/", true);

        foreach (string bundlePath in bundlePaths)
        {
            SetBundle(bundlePath, "", true);
            List <string> pathes = CollectDependencies(bundlePath);

            foreach (string pt in pathes)
            {
                if (pt == bundlePath)
                {
                    continue;
                }

                SetBundleAndAtlas(pt, "", true);
            }
        }
    }
Esempio n. 9
0
        static void InitEffectShader()
        {
            List <string> tmpPaths = EditorResHelper.GetAllResourcePath(Effect_Path, false);

            foreach (string path in tmpPaths)
            {
                string     tmpPath = path.Replace('\\', '/');
                GameObject tmpGo   = AssetDatabase.LoadAssetAtPath <GameObject>(tmpPath);

                if (null == tmpGo)
                {
                    continue;
                }

                Renderer[] tmpRenderers = tmpGo.GetComponentsInChildren <Renderer>(true);

                for (int i = 0; i < tmpRenderers.Length; i++)
                {
                    Material[] mats = tmpRenderers[i].sharedMaterials;
                    for (int j = 0; j < mats.Length; j++)
                    {
                        Material mat = mats[j];
                        if (mat != null)
                        {
                            Shader shader = Shader.Find(mat.shader.name);

                            if (shader != null)
                            {
                                mat.shader = shader;
                            }
                        }
                    }
                }

                EditorUtility.SetDirty(tmpGo);
            }

            AssetDatabase.Refresh();
        }
Esempio n. 10
0
        private static void ClearPackingTagAndAssetBundle()
        {
            //清空根目录Bundles文件夹下的所有资源标记名
            List <string> bundlePaths = EditorResHelper.GetAllResourcePath("Assets/Bundles/", true);

            foreach (string bundlePath in bundlePaths)
            {
                AssetImporter importer = AssetImporter.GetAtPath(bundlePath);
                if (importer == null)
                {
                    continue;
                }
                //Log.Info(bundlePath);
                importer.assetBundleName = "";
            }

            //清空根目录Res文件夹下的所有资源标记名
            List <string> paths = EditorResHelper.GetAllResourcePath("Assets/Res", true);

            foreach (string pt in paths)
            {
                string extendName = Path.GetExtension(pt);
                if (extendName == ".cs")
                {
                    continue;
                }

                AssetImporter importer = AssetImporter.GetAtPath(pt);
                if (importer == null)
                {
                    continue;
                }
                //Log.Info(bundlePath);
                importer.assetBundleName = "";

                SetAtlas(pt, "");
            }
        }