• 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 alexanderameye · Mar 20, 2017 at 05:41 PM · enumpropertydrawerattributepropertyheader

alternative for header atrribute for enums

Header attributes don't work when trying to use them on enum as they only work on fields. What would be the closest thing to achieve the same effect as a header?

Thanks,

Alex

so for example this:

 [Header("Door Settings")]
     public enum TypeOfRotation
     {
             SingleRotation,
             LoopedRotation,
     }
     public TypeOfRotation RotationType;
 
 
     public float InitialAngle = 0f;
     public float FinalAngle = 90f;


gives me the error: Assets/SCRIPTS/DoorPro.cs(18,3): error CS0592: The attribute UnityEngine.HeaderAttribute' is not valid on this declaration type. It is valid on field' declarations only

so I'm forced to move the Header down to the InitialAngle field, but this gives me this layout:

![alt text][1]

where the enum is above the header, which I don't want... [1]: /storage/temp/90339-screenshot-1.jpg

screenshot-1.jpg (10.8 kB)
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 Adam-Mechtley · Mar 20, 2017 at 06:33 PM 0
Share

Hi can you clarify what you are trying to accomplish? What would you expect a Header on an enum to do exactly?

avatar image alexanderameye · Mar 20, 2017 at 09:49 PM 0
Share

I edited the question :)

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Adam-Mechtley · Mar 20, 2017 at 09:54 PM

Put the Header attribute right before the RotationType field, not before the TypeOfRotation definition.

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 alexanderameye · Mar 21, 2017 at 07:17 AM 0
Share

Awesome, thank you!

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

67 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Draw default property types in custom PropertyDrawer 2 Answers

problems writing an enum range attribute 1 Answer

Adding an attribute/type to a transform or object 0 Answers

Material doesn't have a color property '_Color' 4 Answers

Component OnAwake or OnEnable with PropertyAttribute 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges