unity header code example
Example 1: unity add sections to a list
using UnityEngine;public class Example : MonoBehaviour
{
[Header("Health Settings")]
public int health = 0;
public int maxHealth = 100; [Header("Shield Settings")]
public int shield = 0;
public int maxShield = 0;
}
Example 2: header in inspector unity
[Header("Health")]
public int health = 100;
Example 3: unity separator in inspector
using UnityEngine;
public class Example : MonoBehaviour
{
[Header("Hi there!")]
[Space(10)]
[Range(5,9)]
public string playerName = "Unnamed";
}
Example 4: unity inspector header attribute
using UnityEngine;
public class Example : MonoBehaviour
{
[Header("Health Settings")]
public int health = 0;
public int maxHealth = 100;
[Header("Shield Settings")]
public int shield = 0;
public int maxShield = 0;
}