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 /
avatar image
0
Question by Blankzz · Jul 08, 2011 at 12:59 PM · enum

C# Enums get and set accessor expected

Does anybody know why I am getting the "get and set accessor expected" error on InAndOut when creating a enum like so....

 using System;
 
 public static struct TargetFinding
 {
     public Enum View
     {
         InAndOut,
         In,
         Out
     }
 }
Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Joshua · Jul 08, 2011 at 01:06 PM

I think you need an endline when closing your enum. Add a ; after the first } in your script. I also believe there's no need to declare it as public. But I'm no hero when it comes to C#, so I may be way off.

Comment
Add comment · Show 4 · 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 Blankzz · Jul 08, 2011 at 01:14 PM 0
Share

Ye I'm not sure if I need to either. I'll try it without the public and see what happens. Not sure if the semicolon is needed either but I'll add it because semicolons are used in the msdn docs. Thanks

avatar image Blankzz · Jul 08, 2011 at 01:18 PM 1
Share

Just tested without public and just for other peoples reference it does need to be public.

avatar image Joshua · Jul 08, 2011 at 01:23 PM 0
Share

Good to know, thanks.

avatar image Bunny83 · Jul 08, 2011 at 03:06 PM 1
Share

It need to be public when you wnat to use it outside of the struct. The default visibillity in C# is private in Unityscript it's public.

avatar image
0

Answer by Blankzz · Jul 08, 2011 at 01:07 PM

Sorry I was using Enum instead of enum.........

Comment
Add comment · Show 3 · 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 Joshua · Jul 08, 2011 at 01:14 PM 0
Share

ah ;) missed that as well.

avatar image Bunny83 · Jul 08, 2011 at 03:11 PM 0
Share

Well, that's what i would have suggested ;) System.Enum is a class. Btw. do you need it in a struct? You can declare enums even outside of a class / struct. If you need some kind of namespace it's ok

avatar image Blankzz · Jul 08, 2011 at 03:44 PM 0
Share

I don't need them in a struct but its a bit clearer what they are for this way.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Enum not existing in context, but it is right there! 2 Answers

C# Show public members from a second class in Inspector 1 Answer

Rotate an object a set angle over time? (C#) 1 Answer

what is an enum ? 2 Answers

Enum option into a game menu gui 1 Answer


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