/* Author: Syntriax Email: Syntriax@gmail.com Creation Date: 22 September, 2022 - 12:48:16 PM UTC Signed by an automated program written by the author */ using UnityEditor; using UnityEngine; namespace Syntriax.Editor { public class ProjectStructureCreatorEditor : EditorWindow { private const string AssetPath = "Assets"; [MenuItem("Syntriax/Create Project Structure")] private static void CreateStructure() { CreateSubFolder($"{AssetPath}", "Art"); CreateSubFolder($"{AssetPath}/Art", "Materials"); CreateSubFolder($"{AssetPath}/Art", "Models"); CreateSubFolder($"{AssetPath}/Art", "Textures"); CreateSubFolder($"{AssetPath}", "Audio"); CreateSubFolder($"{AssetPath}/Audio", "Musics"); CreateSubFolder($"{AssetPath}/Audio", "Sounds"); CreateSubFolder($"{AssetPath}", "Scripts"); CreateSubFolder($"{AssetPath}", "Level"); CreateSubFolder($"{AssetPath}/Level", "Prefabs"); CreateSubFolder($"{AssetPath}/Level", "UI"); AssetDatabase.MoveAsset($"{AssetPath}/Scenes", $"{AssetPath}/Level/Scenes"); CreateSubFolder($"{AssetPath}/Level", "Scenes"); string thisEditorPath = AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(new ProjectStructureCreatorEditor())); string fileName = System.IO.Path.GetFileName(thisEditorPath); CreateSubFolder($"{AssetPath}/Scripts", "Syntriax"); CreateSubFolder($"{AssetPath}/Scripts/Syntriax", "Editor"); AssetDatabase.MoveAsset(thisEditorPath, $"{AssetPath}/Scripts/Syntriax/Editor/{fileName}"); } private static void CreateSubFolder(string parentFolder, string subFolder) { if (!AssetDatabase.IsValidFolder($"{parentFolder}/{subFolder}")) AssetDatabase.CreateFolder(parentFolder, subFolder); } } }