# Data Slot

This section explains how to create your own data slot.

As an example I will explain how to make data until you exchange data through simple player data creation.

## Create PlayerData script file

Create a script file.

- Select “Create> C # Script” from the Project window right-click menu.
- This time we will name PlayerData.

Write in PlayerData.cs as follows.

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    using UnityEngine;
    using System.Collections;
    using Arbor;

    [System.Serializable]
    public class PlayerData
    {
    	public int maxHP;
    	public int hp;
    }

    [System.Serializable]
    public class OutputSlotPlayerData : OutputSlot<PlayerData>
    {
    }

    [System.Serializable]
    public class InputSlotPlayerData : InputSlot<PlayerData>
    {
    }

### Code explanation

#### Create PlayerData class

This time we are simply creating a class with maximum HP and current HP.

#### Creating the OutputSlotPlayerData class

We are creating a class for outputting PlayerData class.

All processing is provided in OutputSlot<T>, so you do not need to write anything in particular.

We are preparing to avoid the Unity specification that the generic class can not be serialized.

#### Creating the InputSlotPlayerData class

We are creating a class to enter PlayerData class.

Since processing necessary for InputSlot<T> is also prepared here, there is no need to describe contents in particular.