コード例 #1
0
        /// <summary>
        ///  递归更新AssetImporter
        /// </summary>
        /// <param name="path"></param>
        public static void UpdateAssetImporter(string path)
        {
            if (CheckAssetsDuplicationNname.Check(path))
            {
                return;
            }
            AssetImporter ai = AssetImporter.GetAtPath(path);

            if (ai == null)
            {
                EditorUtility.DisplayDialog("错误", string.Format("AssetImporter未成功找到路径:{0}", path), "确定");
                return;
            }
            string    name   = Path.GetFileName(path);
            string    suffix = Path.GetExtension(name);
            AssetType type   = EnumEditorTool.GetAssetType(suffix);

            if (!EnumEditorTool.IsAllowSetAssetBundle(type))
            {
                return;
            }
            SetAssetBundleName(ref ai, name);
            //获得关联资源路径
            string[] dependencys = AssetDatabase.GetDependencies(path, false);
            string   dependency  = string.Empty;

            for (int i = 0; i < dependencys.Length; i++)
            {
                dependency = dependencys[i];
                if (string.IsNullOrEmpty(dependency))
                {
                    continue;
                }
                string dependencyName = Path.GetFileName(dependency);
                if (dependencyName.Contains(name))
                {
                    continue;
                }
                UpdateAssetImporter(dependency);
            }
        }
コード例 #2
0
 public static void CheckAssetsDuplicationNnameTool()
 {
     CheckAssetsDuplicationNname.Check();
 }