- Home /
Header attribute with multiple lines of text?
header attribute is really handy to explain the public fields in my components.
http://docs.unity3d.com/ScriptReference/HeaderAttribute.html
[Header("Health Settings")]
public int health = 0;
Just wondering can this work with multiple lines of text? Or is there some other handy way of achieveing that effect (ie. several lines of text above my field explaining it)
EDIT: I have one sorta solution like so..
[Header("Health Settings")]
[Header("Set health here!")]
public int health = 0;
but it would be nice if I could make the text arbitrarily long and it could wrap
Your solution not always work because it can be flipped sometimes, use the order parameter, see my respnse.
Answer by fermmmm · Apr 04, 2016 at 09:02 AM
[Header("This is the first line of the header text ", order=0)]
[Space(-10, order = 1)]
[Header("and this is the second one. With the", order=2)]
[Space(-10, order = 3)]
[Header("space and order settings it looks good.", order=4)]
[Space(10, order = 5)]
Answer by David-Filipe · Oct 04, 2018 at 01:31 PM
[Header ("Health Settings."), Space (5), Header ("Set health here!")]
Answer by sudhir_kotila · Apr 04, 2016 at 06:29 AM
Hi, deltron1830
Please, Try this.
[Header ("Health Settings." + "\n" + "Set health here!")]
public int health = 0;
This ends up just looking weird in the editor. The lines are stacked on top of each other.
Your answer
![](https://koobas.hobune.stream/wayback/20220613164813im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
alternative for header atrribute for enums 1 Answer
Is RequireComponent[typeof(CustomScript)] possible? 2 Answers
How could i differentiate attributes using code? 0 Answers
Is it possible to add an icon to indicate there is an editor tooltip decorating a variable? 0 Answers
Custom [Require*] attribute 2 Answers