unable to add new categories to enum
so i created an enumeration and declared a variable with the enum. I have been using it for a while and needed to add a new category to my enum. I added the new category, but i unity keeps telling me that a definition does not exist for the new category of the enum. A dropdown list populates and shows all of my old enum categories, but the new one simply will not show up. I have no compiler errors(except the no definition). I am rather new to enums, but i dont understand how i can access some of the categories but not all of them.
public enum CharacterState { Idle = 0, Walking = 1, Trotting = 2, Running = 3, Jumping = 4, Slicing = 5, Aiming = 6, Recoil = 7, Recoil2 = 8, }
(I'm unable to access Recoil or Recoil2)
New definitions won't show in the Intellisense drop-down until the script has been saved and compiled. Sounds silly, but have you saved the script?
Yes, I save constantly and even closed unity and visual studio and opened the project back up.
Another note, you don't have to explicitly set the numeric values, they would receive the values 0 through 8 in the order they are defined.
Answer by hiddenburrito · Nov 13, 2015 at 03:02 AM
remove the last comma after Recoil2=8
The last element doesn't need a trailing comma. This should have caused a compile error but I've seen crazier things not produce errors.