Answers for "unity editor dropdown menu inspector"

C#
0

unity create drop down menu in inspector

public class Player : Monobehaviour
{
 	public List<string> NameList;
    [Dropdown("NameList")]//input the path of the list
    public string MyName; 
}
Posted by: Guest on March-30-2021
0

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;
Posted by: Guest on June-22-2021

C# Answers by Framework

Browse Popular Code Answers by Language