unity label in inspector 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: Create gaps / headers between variables in the unity inspector

float variable1;
[Space] //Creates a space inside of the unity editor
[Header("This is a header")] //Creates a header inside of the unity editor
float variable2;