unity dropdown variable
//Use an enum to get editor dropdown variables.
//Define the enum
public enum Foods
{
apple,
pie,
hamburger
};
//Create the variable field
[SerializeField] public Foods m_foods;
//Get value and do stuff with it
string favouriteFood()
{
switch (m_foods) //Switch is like if but in cleaner.
{ //We use it so we arent yandereDev.
case Foods.apple:
return "apple";
case Foods.pie:
return "pie";
case Foods.hamburger:
return "hamburger";
}
return "Error"; //Triggered if selected value not found in list.
}