PHeader

  06. Attributes No Comments

Adds a header above the target in the Inspector.

This is just like Unity’s built-in Header attribute except that it supports targeting of properties and methods in addition to fields.
It also includes a couple of convenient constructors that make it easier to do some types of headers.

PHeader(string header)

Adds the given header text above a field, property or a method in the Inspector.

PHeader(params string[] headerLines)

Adds the given header consisting of two or more lines of text above a field, property or a method in the Inspector.

PHeader(string header, int fontSize)

Adds the given header text using the specified font size above a field, property or a method in the Inspector.

PHeader(string header, int fontSize, string color)

Adds the given header text using the specified font size and color above a field, property or a method in the Inspector.
If fontSize equals 0, then the default font size is used.
The color can be provided in HTML format (for example #ff0000ff) or using the in name of the color (for example red).

Attribute Target

Field, property, method or indexer.

Example

using UnityEngine;
using Sisus.Attributes;

public class Headers : MonoBehaviour
{
	[Header("Long headers can be shown without information being cut off because word wrapping is supported. ")]
	public bool wordWrappingSupport = true;

	[Header("You can also use\nmanual\nline breaks.")]
	public bool lineBreakSupport = true;

	[Header("<size=15>Rich text markup is <color=green>supported</color></size>")]
	public bool richTextSupport = true;	

	[PHeader("The PHeader attribute can be used to add headers before properties and methods.")]
	[ShowInInspector]
	public bool Property
	{
		get;
		set;
	}
}

Example Result