- Home /
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
Hi can you clarify what you are trying to accomplish? What would you expect a Header on an enum to do exactly?
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.