- Home /
How would i use a enum?
I've seen others use enums before but i want to know if i can use it in this case...
Lets say im building some sort of skill manager type thing
and i use a enum like this...
public enum Skills
name,
icon,
difficulty
three thing i need to say/ask, 1. How would i even create the enum im most likely guessing im using the wrong format. 2. Can i use it in this case 3. How would i call it to make more skills... like attack and shit like that
Answer by Bunny83 · Feb 26, 2011 at 01:45 AM
You example confuses me a bit. "name, icon, difficulty" are not really skills aren't they? That looks more like properties... Do you use Javascript or C#? Anyway, the syntax is the same. You forget the curly brackets.
public enum Skills
{
name,
icon,
difficulty
}
Take a look at this question first:
http://answers.unity3d.com/questions/7950/how-to-declare-and-use-a-enum-variable-in-javascript
An enum just holds some named constants and can be used as a type. An enum variable is the same as an int variable They can of course be used as some sort of identifer for skills or as an index into an array.
Your answer

Follow this Question
Related Questions
Error calling enum lists 1 Answer
help with Flashlight Pickup 1 Answer
Smooth rotate use joystick 1 Answer
Animation editing help? 0 Answers
Acceleration problems (don't know how to make it stop moving) 0 Answers