欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Unity快速生成常用文件夹的方法

程序员文章站 2023-12-29 13:06:04
本文实例为大家分享了unity快速生成常用文件夹的具体代码,供大家参考,具体内容如下前言每次打开新工程创建文件夹都很麻烦,写了一个小工具代码using unityengine;using system...

本文实例为大家分享了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下面得生成常用文件夹

Unity快速生成常用文件夹的方法

即可在assets下自动生成文件夹

Unity快速生成常用文件夹的方法

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。

相关标签: unity 文件夹

上一篇:

下一篇: