# Variable

You can script types for Blackboard Variables.

## How to write a script

- Create the type in public.
- Defines a type that Unity can serialize.
  - Class or struct applying `System.SerializableAttribute`
  - enum type
  - Classes that inherit from `UnityEngine.Object`

## Code example

    1
    2
    3
    4
    5
    6
    7
    [System.Serializable]
    public struct CharacterStats
    {
        public int health;
        public int attack;
        public int defence;
    }

After creating this script, Serializable > Character Stats will be added to the Variable addition menu.

## HideInVariableMenuAttribute

By applying `HideInVariableMenuAttribute` to the type, you can hide it from the Variable addition menu.