This is the documentation for Arbor 3.2.4 and earlier.
See Arbor Documentation for the latest documentation.
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.
Contents
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.
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.