コード例 #1
0
        public static void BuildAssetBundlesInSelectFolder()
        {
            string selectPath = EditorUtils.GetSelectedDirAssetsPath();//.CurrentSelectFolder;

            if (selectPath == null)
            {
                Log.w("Not Select Any Folder!");
                return;
            }

            BuildAssetBundlesInFolder(selectPath);
        }
コード例 #2
0
        public static void GenAssetNameAsFolderName()
        {
            string selectPath = EditorUtils.GetSelectedDirAssetsPath();

            if (selectPath == null)
            {
                Log.w("Not Select Any Folder!");
                return;
            }

            AutoGenAssetNameInFolder(selectPath, true);
            Log.i("Finish GenAssetNameAsFolderName.");
        }
コード例 #3
0
        //自动设置选中目录下的AssetBundle Name
        public static void GenAssetNameAsFileName()
        {
            string selectPath = EditorUtils.GetSelectedDirAssetsPath();

            if (selectPath == null)
            {
                Log.W("Not Select Any Folder!");
                return;
            }

            AutoGenAssetNameInFolder(selectPath, false);

            AssetDatabase.SaveAssets();
            Log.I("Finish GenAssetNameAsFileName.");
        }
コード例 #4
0
        public static void BuildAppConfig()
        {
            AppConfig data           = null;
            string    folderPath     = EditorUtils.GetSelectedDirAssetsPath();
            string    spriteDataPath = folderPath + "/AppConfig.asset";

            data = AssetDatabase.LoadAssetAtPath <AppConfig>(spriteDataPath);
            if (data == null)
            {
                data = ScriptableObject.CreateInstance <AppConfig>();
                AssetDatabase.CreateAsset(data, spriteDataPath);
            }
            Log.i("Create App Config In Folder:" + spriteDataPath);
            EditorUtility.SetDirty(data);
            AssetDatabase.SaveAssets();
        }
コード例 #5
0
        public static void BuildSpritesData()
        {
            SpritesData data           = null;
            string      folderPath     = EditorUtils.GetSelectedDirAssetsPath();
            string      spriteDataPath = folderPath + "SpritesData.asset";

            data = AssetDatabase.LoadAssetAtPath <SpritesData>(spriteDataPath);
            if (data == null)
            {
                data           = ScriptableObject.CreateInstance <SpritesData>();
                data.atlasName = folderPath;
                AssetDatabase.CreateAsset(data, spriteDataPath);
            }

            data.ClearAllSprites();

            string workPath  = EditorUtils.AssetsPath2ABSPath(folderPath);
            var    filePaths = Directory.GetFiles(workPath);

            for (int i = 0; i < filePaths.Length; ++i)
            {
                string relPath            = EditorUtils.ABSPath2AssetsPath(filePaths[i]);
                UnityEngine.Object[] objs = AssetDatabase.LoadAllAssetsAtPath(relPath);

                if (objs != null)
                {
                    for (int j = 0; j < objs.Length; ++j)
                    {
                        if (objs[j] is Sprite)
                        {
                            data.AddSprite(objs[j] as Sprite);
                        }
                        else if (objs[j] is Texture2D)
                        {
                            ProcessSpriteTextureImport(relPath, folderPath);
                        }
                    }
                }
            }

            EditorUtility.SetDirty(data);
            AssetDatabase.SaveAssets();

            Log.i("Success Process SpriteImport:" + folderPath);
        }