https://github.com/solidalloy/structdropdown
Create drop-down lists which can contain objects of any type with one simple attribute
https://github.com/solidalloy/structdropdown
Last synced: over 1 year ago
JSON representation
Create drop-down lists which can contain objects of any type with one simple attribute
- Host: GitHub
- URL: https://github.com/solidalloy/structdropdown
- Owner: SolidAlloy
- License: other
- Created: 2020-05-08T17:42:36.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-10-03T18:24:22.000Z (almost 6 years ago)
- Last Synced: 2025-02-28T17:25:56.226Z (over 1 year ago)
- Language: C#
- Homepage:
- Size: 209 KB
- Stars: 11
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Drop-down with objects of any type in Unity Inspector
Create drop-down lists that can contain objects of any type with one simple attribute (and a tiny helper struct).
## How to use
### Install via Git URL
Project supports Unity Package Manager. To install the project as a Git package, do the following:
1. In Unity, open **Window** -> **Package Manager**.
2. Press the **+** button, choose "**Add package from git URL...**"
3. Enter "https://github.com/SolidAlloy/StructDropDown.git#upm" and press **Add**.
### Add to project Assets
Alternatively, you can add the code directly to the project:
1. Clone the repo or download the latest release.
2. Add the StructDropDown folder to your Unity project.
### Use the DropDown attribute
1. Create a struct or class which will hold the choices of a drop-down list

2. Add the DropDown attribute to a field and specify the struct to use for the drop-down list.

3. You should now see a drop-down list with the choices from your struct.

Credits
------------
- Code to handle target objects of serialized properties is taken from [SpacePuppy Unity Framework](https://github.com/lordofduct/spacepuppy-unity-framework-3.0)
- GitHub action to split the upm branch was created by [rfadeev](https://github.com/rfadeev)