📜  unity editor dropdown - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:06.689000             🧑  作者: Mango

代码示例1
//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 NameList;
[Dropdown("NameList")]//input the path of the list
public string MyName;