Create the pre-directory structure:
The directory structure after creation:
usingSystem.Collections;usingSystem.Collections.Generic;usingUnityengine;usingUnityeditor;usingSystem.IO;usingSystem.Text; Public classbuildtool{[MenuItem ("Buildtool/refreshcloth/refreshselectclothconfig")] Static voidRefreshselectcloth () {stringConfigrootpath ="Assets/clothconfig"; foreach(Unityengine.object oinchSelection.getfiltered (typeof(Gameobject), selectionmode.deepassets)) { //ASSETS/FBX/CHARACTER/MODELS/G_CLOTH_50133/G_CLOTH_50133.FBX stringClothpath =Assetdatabase.getassetpath (o); //get the name of the model configuration, as in the example: g_cloth_50133 intSubstart = Clothpath.lastindexof ('/') +1; intSublenth = Clothpath.lastindexof ('.') -Substart; stringClothconfigname =clothpath.substring (Substart, sublenth); //get the storage path for the model configuration, as in the example: assets/zlgstest/clothconfig/g_cloth_50133//Note that the path is stored instead of the file stringClothconfigpath = Configrootpath +"/"+Clothconfigname; //if the above path does not exist, go to create a if(!directory.exists (Clothconfigpath)) Directory.CreateDirectory (Clothconfigpath); } Assetdatabase.refresh (); }}
It is important to note that you must first select a model resource before you create it!!!
Unity dynamically creates a storage path for FBX model configuration files