- Home /
Question by
partoAraGamers · Sep 16, 2017 at 10:28 AM ·
c#unity 5unity5
How to create a Drop Down menu for a script file?
Hi ....
I want to create a script file that anyone can control the bool variables in it buy selecting the variable in a drop down menu...
Something like what is in the image below!
How can i do that?
mydrop.png
(5.1 kB)
Comment
Best Answer
Answer by Raimi · Sep 16, 2017 at 11:17 PM
You can use an enum....
public class MainClass : MonoBehaviour
{
public enum Type{ One, Two, Three}
public Type type;
void Start()
{
//Example usage
switch(type)
{
case Type.One:
Debug.Log("One");
break;
case Type.Two:
Debug.Log("Two");
break;
case Type.Three:
Debug.Log("Three");
break;
}
}
}