当前位置: 移动技术网 > IT编程>开发语言>Java > Unity快速生成常用文件夹的方法

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

2020年09月06日  | 移动技术网IT编程  | 我要评论
本文实例为大家分享了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下面得生成常用文件夹

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

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

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网