# Behaviour interfaces

There are several interfaces available for scripts such as StateBehaviour, Calculator, and ActionBehaviour.

# Target scripts

The target script is as follows.

- StateBehaviour
- Calculator
- ActionBehaviour
- Decorator
- Service

# INodeBehaviourSerializationCallbackReceiver

An interface for receiving serialization callbacks in the node’s behaviour script.

ScriptReference: INodeBehaviourSerializationCallbackReceiver

Since the Unity standard ISerializationCallbackReceiver is used internally, please use this if you want to receive a callback.

## Example

### Script

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    using UnityEngine;
    using System.Collections.Generic;
    using Arbor;

    [AddComponentMenu("")]
    public class ExampleSerializationCallback : StateBehaviour, INodeBehaviourSerializationCallbackReceiver
    {
    	public List<int> _keys = new List<int> { 3, 4, 5 };
    	public List<string> _values = new List<string> { "I", "Love", "Unity" };

    	public Dictionary<int, string> _myDictionary = new Dictionary<int, string>();

    	public void OnBeforeSerialize()
    	{
    		_keys.Clear();
    		_values.Clear();

    		foreach (var kvp in _myDictionary)
    		{
    			_keys.Add(kvp.Key);
    			_values.Add(kvp.Value);
    		}
    	}

    	public void OnAfterDeserialize()
    	{
    		_myDictionary = new Dictionary<int, string>();

    		for (int i = 0; i < Mathf.Min(_keys.Count, _values.Count); i++)
    			_myDictionary.Add(_keys[i], _values[i]);
    	}

    	public override void OnStateBegin()
    	{
    		foreach (var kvp in _myDictionary)
    		{
    			Debug.Log("Key: " + kvp.Key + " value: " + kvp.Value);
    		}
    	}
    }

# INodeGraphContaiiner

An interface to use when a node’s behavior script contains subgraphs.

ScriptReference: INodeGraphContaiiner