719 B
719 B
#unity/日常积累
通过SubString()就可以获取到物体所在文件夹了
如果文件夹不存在,就创建:
public void AddResource()
{
currentLobbyCameraAnimationPath =
$"Assets/BundleResources/CommonRegion/OutsideGame/Skins/Characters/{RoleIndex}/SkinParts/{NumberIndex}/RelatedResources/ani&{NumberIndex}_LobbyCameraAnimation_Height.anim";
string path =
currentLobbyCameraAnimationPath.Substring(0, currentLobbyCameraAnimationPath.LastIndexOf(@"/"));
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
}
