- Home /
Unity header attribute for only 1 field
When I put my [Header] attribute above my float float1, float2, float3 it makes a header for all 3 float. I want it to be there only once and I also want to keep my floats like that. What can I do?
Answer by Bunny83 · Jun 14, 2018 at 10:10 PM
You can't- If you declare several variables inline they will have the same visibility, type and attributes. That's the point of declaring them inline. If you want any of those to be different for two or more variables you have to declare them seperately:
[Header("FooBar")]
public float float1;
public float float2;
public float float3;
Actually for public variables that should be serialized and should show up in the inspector it's generally recommended to declare them seperately as it's more clear that those are actual public variables. I guess your variable names are just examples names and not your actual variables.
Your answer
Follow this Question
Related Questions
Adding header info to www "GET" method. 3 Answers
How to remove the heading gap(margin) in uGUI(4.6) text 0 Answers
(Inspector) Change Header Color 0 Answers
WWW.responseHeaders or WWW.error are not working on iOS when use invalid url 3 Answers
Scrollview with dynamic header (disappear when scroll up and appear when scroll down... smoothly) 0 Answers