Unity——————自定义文件夹

来源:互联网 发布:windows录音机 编辑:程序博客网 时间:2024/06/05 06:50
using UnityEditor;
using UnityEngine;
using System.Collections;

using System.IO;

public class init_Folder : MonoBehaviour {

    // Use this for initialization
    void Start () {
    
    }
    
    // Update is called once per frame
    void Update () {
    
    }
    //创建 场景 文件夹
    [MenuItem ("MyMenu/create_ScenesFolder")]
    static void create_Scenes(){
        string strPath =  Application.dataPath + "/Scenes";
        print (strPath);
        if (!Directory.Exists(strPath )) {
            Directory.CreateDirectory (strPath );
        }
    }
    //创建 脚本 文件夹
    [MenuItem ("MyMenu/create_ScriptsFolder")]
    static void create_Scripts(){
        string strPath =  Application.dataPath + "/Scripts";
        print (strPath);
        if (!Directory.Exists(strPath )) {
            Directory.CreateDirectory (strPath );
        }
    }
    //创建 材质 文件夹
    [MenuItem ("MyMenu/create_MaterialsFolder")]
    static void create_Materials(){
        string strPath =  Application.dataPath + "/Materials";
        print (strPath);
        if (!Directory.Exists(strPath )) {
            Directory.CreateDirectory (strPath );
        }
    }

}
0 0