Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

unity editor dropdown

//there are two main ways of doing this.
//1. Enumerators
enum Level {Low, Medium, High}
public Level myLevel; //this variable will appear as a drop down
//this method does only work for enum values so if you want strings you'll
//have to use method 2.
//2. Dropdown list. This one requires you to add an asset from the unity store.
//Link: https://assetstore.unity.com/packages/tools/utilities/dropdown-attribute-180951
public List<string> NameList;
[Dropdown("NameList")]//input the path of the list
public string MyName; 
 
PREVIOUS NEXT
Tagged: #unity #editor #dropdown
ADD COMMENT
Topic
Name
1+5 =