The Project Setup Unity Package is designed to automate the creation of a consistent folder structure and organized hierarchy in new Unity projects. This package saves you time and ensures that your projects start off neat and tidy.
- Automatically generates essential folders such as
Materials,Prefabs,Packages,Scenes, andScripts(with subfolders forData,Controllers,Input, andManagers).
- Sets up a clear and organized hierarchy in the scene with GameObjects for
Controllers,Camera,Environment,Lights,UI,Audio,Misc, andManagers.
- Download the
ProjectSetup.unitypackagefile from the Releases page.
- Open your Unity project.
- Go to
Assets -> Import Package -> Custom Package.... - Select the
ProjectSetup.unitypackagefile you downloaded. - Click
Importto add the package to your project.
- In Unity, go to
Solace Tools -> Setup Project Structure.
- The script can be easily customized to add or remove folders and hierarchy elements according to your project's needs. Simply edit the
ProjectSetup.csscript located in theEditorfolder.
- Feel free to fork the repository and submit pull requests with improvements or additional features.
This project is licensed under the MIT License - see the LICENSE file for details.
Here is the core of the ProjectSetup.cs script:
using UnityEditor;
using UnityEngine;
public class ProjectSetup : MonoBehaviour
{
[MenuItem("Solace Tools/Setup Project Structure")]
private static void SetupProjectStructure()
{
CreateFolders();
CreateHierarchy();
}
private static void CreateFolders()
{
string[] folders = new string[]
{
"Assets/Materials",
"Assets/Prefabs",
"Assets/Packages",
"Assets/Scenes",
"Assets/Scripts",
"Assets/Scripts/ScriptableObjects",
"Assets/Scripts/Data",
"Assets/Scripts/Controllers",
"Assets/Scripts/Input",
"Assets/Scripts/Managers"
};
foreach (string folder in folders)
{
if (!AssetDatabase.IsValidFolder(folder))
{
AssetDatabase.CreateFolder(GetParentFolder(folder), GetFolderName(folder));
}
}
AssetDatabase.Refresh();
}
private static string GetParentFolder(string folder)
{
return folder.Substring(0, folder.LastIndexOf('/'));
}
private static string GetFolderName(string folder)
{
return folder.Substring(folder.LastIndexOf('/') + 1);
}
private static void CreateHierarchy()
{
string[] hierarchy = new string[]
{
"--- Controllers ---",
"--- Camera --------",
"--- Environment ----",
"--- Lights --------",
"--- UI ------------",
"--- Audio ---------",
"--- Misc ----------",
"--- Managers ------"
};
foreach (string name in hierarchy)
{
if (GameObject.Find(name) == null)
{
new GameObject(name);
}
}
}
}