标签:substring dex 创建 har text data pat .com 分享图片
创建前目录结构:
创建后的目录结构:
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEditor; using System.IO; using System.Text; public class BuildTool { [MenuItem("BuildTool/RefreshCloth/RefreshSelectClothConfig")] static void RefreshSelectCloth() { string configRootPath = "Assets/ClothConfig"; foreach (UnityEngine.Object o in Selection.GetFiltered(typeof(GameObject), SelectionMode.DeepAssets)) { //Assets/FBX/Character/Models/g_Cloth_50133/g_Cloth_50133.FBX string clothPath = AssetDatabase.GetAssetPath(o); //获得模型配置的名字,例子中即: g_Cloth_50133 int subStart = clothPath.LastIndexOf(‘/‘) + 1; int subLenth = clothPath.LastIndexOf(‘.‘) - subStart; string clothConfigName = clothPath.Substring(subStart, subLenth); //获得模型配置的存放路径,例子中即: Assets/ZLgsTest/ClothConfig/g_Cloth_50133 //注意是存放路径,而不是文件 string clothConfigPath = configRootPath + "/" + clothConfigName; //如果以上路径不存在,则去创建一个 if (!Directory.Exists(clothConfigPath)) Directory.CreateDirectory(clothConfigPath); } AssetDatabase.Refresh(); } }
需要注意的是,在创建之前一定要先选中一个 模型资源!!!
标签:substring dex 创建 har text data pat .com 分享图片
原文地址:https://www.cnblogs.com/luguoshuai/p/9148153.html