Unity快速生成常用文件夹的方法
本文实例为大家分享了Unity快速生成常用文件夹的具体代码,供大家参考,具体内容如下
前言
每次打开新工程创建文件夹都很麻烦,写了一个小工具
代码
using UnityEngine;
using System.Collections;
using System.IO;
using UnityEditor;
public class FolderGenerator
{
[MenuItem("Tools/生成常用文件夹--GenerateFolders")]
private static void GenerateFolder()
{
string resPath = Application.dataPath + "/Resources/";//resources路径
string path = Application.dataPath + "/";//路径
Directory.CreateDirectory(resPath + "Audio");
Directory.CreateDirectory(resPath + "Materials");
Directory.CreateDirectory(resPath + "Prefabs");
Directory.CreateDirectory(resPath + "Shaders");
Directory.CreateDirectory(resPath + "Textures");
Directory.CreateDirectory(path + "Scenes");
Directory.CreateDirectory(path + "Editor");
Directory.CreateDirectory(path + "StreamingAssets");
Directory.CreateDirectory(path + "Scripts");
AssetDatabase.Refresh();
Debug.Log("Folders Created");
}
}
}
用法
点击Tools下面得生成常用文件夹
即可在Assets下自动生成文件夹
以上是 Unity快速生成常用文件夹的方法 的全部内容, 来源链接: utcz.com/z/356461.html