• 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 /
avatar image
3
Question by Hayloe · Oct 21, 2013 at 06:37 PM · playererror messageenumunsupported

Unsupported enum type

Well heres my code for my enum.

 enum PlayerDirection : sbyte
 {
     Left = -1,
     Right = 1
 }

whenever I run, everything works good, and I can Debug.Log the values by casting to int, although im getting these hardmless errors

 Unsupported enum type: playerDirection
 
 Unsupported enum type: Left
 UnityEditor.DockArea:OnGUI()
 
 Unsupported enum type: Right
 UnityEditor.DockArea:OnGUI()
 
 


I've tried specifying System.NonSerializable, and I tried [HideInspector] but no luck. I've also tried take out the declaration for sbyte, and it still throws up the first error (but not the last two).

I need them stored this way so I can adjust movement based on direction (addforce (30 * playerDirection)) for example.

Comment
Add comment · Show 2
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 VesuvianPrime · Oct 22, 2013 at 02:51 AM 1
Share

Why not use static consts ins$$anonymous$$d?

avatar image Hayloe · Oct 22, 2013 at 04:32 PM 0
Share

because i'm using this to deter$$anonymous$$e the math for the movement, but I'm also doing checks to it to see what direction the player is facing. I suppose I could use 3 variables (2 const's, left and right) and then a currDirection variable, but that would end up being 3 bytes ins$$anonymous$$d of 1. I'ts not a huge difference but its still a waste. this code works great, I just don't know why its throwing up that error.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by flaviusxvii · Oct 22, 2013 at 04:33 PM

None of those 3 things it complains about are enum types. So everything looks great.

Comment
Add comment · Show 1 · 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
avatar image Hayloe · Oct 22, 2013 at 08:15 PM 0
Share

Could you explain a bit more please?

 enum PlayerDirection : sbyte
 {
     Left = -1,
     Right = 1
 }
avatar image
3

Answer by eric21000 · Oct 29, 2013 at 10:08 AM

I had the same problem with uint enum. Unity seems to manage only int enum. Use int instead of sbyte and it should work.

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

19 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Issue with GameObject has been destroyed but it is not destroyed 1 Answer

Beginner trying to stop movement function and collision on death ? 0 Answers

Problems with a player spawning and handling script 1 Answer

Drop-down enum pauses player - must it be so? 1 Answer

unity missing reference exception the object of type transform has been destroyed but you are still trynig to access it 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