Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by Ponasity · Nov 12, 2015 at 04:30 PM · enumenumerate

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)

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Jessespike · Nov 12, 2015 at 05:45 PM 0
Share

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?

avatar image Ponasity Jessespike · Nov 12, 2015 at 11:21 PM 0
Share

Yes, I save constantly and even closed unity and visual studio and opened the project back up.

avatar image MakinStuffLookGood · Nov 12, 2015 at 07:31 PM 0
Share

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.

avatar image Ponasity MakinStuffLookGood · Nov 12, 2015 at 11:22 PM 0
Share

cool, i didnt know that

1 Reply

· Add your reply
  • Sort: 
avatar image
0

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Interfaces vs methods selection using if(enumerations) 0 Answers

How to limit the types shown at the inspector in a public enum based on another public enum type selected? 1 Answer

check enum from another script? 1 Answer

Enum comparison C# 1 Answer

Active and Inactive Spawn Points 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges