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?
so for example this:
public enum TypeOfRotation
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
Assets/SCRIPTS/DoorPro.cs(18,3): error CS0592: The attribute
field' declarations only
so I'm forced to move the Header down to the InitialAngle field, but this gives me this layout:
where the enum is above the header, which I don't want...
Hi can you clarify what you are trying to accomplish? What would you expect a Header on an enum to do exactly?
I edited the question :)
Answer by Adam-Mechtley
Mar 20 at 09:54 PM
Put the Header attribute right before the RotationType field, not before the TypeOfRotation definition.
Awesome, thank you!
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
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.
Answers and Comments
70 People are following this question.
Draw default property types in custom PropertyDrawer
problems writing an enum range attribute
Adding an attribute/type to a transform or object
Component OnAwake or OnEnable with PropertyAttribute
PropertyDrawer: Enum to select extended class