FolderAttribute
And NOW you can reference folders into Unity's Inspector.
That's what I've been waiting for years, until I decided to code it myself! Enjoy :D
Getting Started
For a quick import into an existing project, just get the UnityPackage.
The FolderAttribute folder is an empty project with only the plugin imported and some examples! :)
See the Code Usage for details on how to use it in your project.
Code Usage
using Folder; // Don't forget this.
[Folder]
public string materialsFolder; // A variable with [Folder] must be a string.
void Start()
{
// Get the content of the folder!
Material[] materials = materialsFolder.LoadFolder<Material>();
}
Screenshots
Warning
If you've made some changes to folders that are referenced in the inspector via FolderAttribute (like moving/renaming/deleting folders), it's always a good practice to enter Play mode to check you've not broken anything. Plus, it will update some references under-the-hood to ensure that your project can be shared with others without any broken reference.
Notes
- Last tested with Unity 2019.1.0f2 from 15 April 2019.
Authors
- Special thanks to Jérémy Chopin
- Arthur Cousseau
License
This project is licensed under the MIT License - see the LICENSE.md file for details