Create drop-down lists that can contain objects of any type with one simple attribute (and a tiny helper struct).
Project supports Unity Package Manager. To install the project as a Git package, do the following:
- In Unity, open Window -> Package Manager.
- Press the + button, choose "Add package from git URL..."
- Enter "https://github.com/SolidAlloy/StructDropDown.git#upm" and press Add.
Alternatively, you can add the code directly to the project:
- Clone the repo or download the latest release.
- Add the StructDropDown folder to your Unity project.
-
Create a struct or class which will hold the choices of a drop-down list
-
Add the DropDown attribute to a field and specify the struct to use for the drop-down list.
-
You should now see a drop-down list with the choices from your struct.
- Code to handle target objects of serialized properties is taken from SpacePuppy Unity Framework
- GitHub action to split the upm branch was created by rfadeev