zoukankan      html  css  js  c++  java
  • 批量设置AssetBundleName

    using UnityEngine;
    using System.Collections;
    using UnityEditor;
    using System.IO;
    
    public class ChangeName : MonoBehaviour {
    
    //    public string versionDir;
    //    public string abName;
    
        void Start () 
        {
            for(int i = 0;i< 27;i++)
            {
                string path = "RES/com/face/prefab/0_"+i;
                string abname = "face0_" + i;
                SetVersionDirAssetName (path,abname);
            }
        }
        
        public void SetVersionDirAssetName(string versionDir,string abName)
        {
            var fullPath = Application.dataPath + "/" + versionDir + "/";
            var relativeLen = versionDir.Length + 8; // Assets 长度
            if (Directory.Exists(fullPath))
            {
                EditorUtility.DisplayProgressBar("设置AssetName名称", "正在设置AssetName名称中...", 0f);
                var dir = new DirectoryInfo(fullPath);
                var files = dir.GetFiles("*", SearchOption.AllDirectories);
                for (var i = 0; i < files.Length; ++i)
                {
                    var fileInfo = files[i];
                    EditorUtility.DisplayProgressBar("设置AssetName名称", "正在设置AssetName名称中...", 1f * i / files.Length);
                    if (!fileInfo.Name.EndsWith(".meta"))
                    {
                        var basePath = fileInfo.FullName.Substring(fullPath.Length - relativeLen).Replace('\', '/');
                        var importer = AssetImporter.GetAtPath(basePath);
                        if (importer && importer.assetBundleName != versionDir)
                        {
                            importer.assetBundleName = abName;
                        }
                    }
                }
                EditorUtility.ClearProgressBar();
            }
        }
    }
  • 相关阅读:
    1.2 软件测试的分类和职业生涯
    1.1:软件测试的发展
    1,select查询详解
    7、网页
    6、开学典礼
    5、边框属性和display
    4、盒子模型和margin、padding
    3、字体、背景、和文本的属性
    2、Css中的样式选择器
    16. C# 对象初始化器
  • 原文地址:https://www.cnblogs.com/602147629/p/5239628.html
Copyright © 2011-2022 走看看