Skip to content

Instantly share code, notes, and snippets.

@alecnunn
Last active April 6, 2023 16:40
Show Gist options
  • Save alecnunn/e106890a82e8de685343852106c6b1bc to your computer and use it in GitHub Desktop.
Save alecnunn/e106890a82e8de685343852106c6b1bc to your computer and use it in GitHub Desktop.
Unity3D Scripts that I use to make development just a bit easier from time to time.
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEngine;
namespace Vectohl {
public class MenuItems {
[MenuItem("Endorin/Generate File Structure")]
private static void GenerateFileStructure() {
var folders = new List<string>() {
// art stuff
"Art",
"Art/Materials",
"Art/Sprites",
"Art/Textures",
// audio stuff
"Audio",
"Audio/Music",
"Audio/Sounds",
// 3d stuff
"Animations",
"Models",
"Models/Characters",
"Models/Environment",
// code stuff
"Scripts",
"Shaders",
// editor stuff
"Editor",
// other stuff
"Prefabs",
"Plugins",
"Resources",
"Scenes"
};
foreach (string folder in folders) {
if(_checkFolder(folder)) {
_makeFolder(folder);
}
}
Debug.Log("Successfully generated project structure");
}
private static void _makeFolder(string name) {
if (!name.Contains("/")) {
AssetDatabase.CreateFolder("Assets", name);
} else {
AssetDatabase.CreateFolder("Assets/" + name.Split('/')[0], name.Split('/')[1]);
}
}
private static bool _checkFolder(string name) {
return !Directory.Exists("Assets/" + name);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment