StateMachineBehaviour はステートマシンのステートに追加できるコンポーネントです。ステートのすべてのスクリプトが継承する基底クラスでもあります。
        By default the Animator does instantiate a new instance of each behaviour define in the controller. The class attribute SharedBetweenAnimatorsAttribute controls how behaviours are instantiated.
StateMachineBehaviour has some predefined messages:
OnStateEnter, OnStateExit, OnStateIK, OnStateMove, OnStateUpdate.
      
using UnityEngine;
public class AttackBehaviour : StateMachineBehaviour { public GameObject particle; public float radius; public float power;
protected GameObject clone;
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { clone = Instantiate(particle, animator.rootPosition, Quaternion.identity) as GameObject; Rigidbody rb = clone.GetComponent<Rigidbody>(); rb.AddExplosionForce(power, animator.rootPosition, radius, 3.0f); }
override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { Destroy(clone); }
override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { Debug.Log("On Attack Update "); }
override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { Debug.Log("On Attack Move "); }
override public void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { Debug.Log("On Attack IK "); } }
| OnStateMachineEnter | Called on the first Update frame when making a transition to a state machine. This is not called when making a transition into a state machine sub-state. | 
| OnStateMachineExit | StateMachine からの移行を行うとき、最後の Update フレームが呼ばれます。StateMachine のサブステートの中へ移行を行うとき、これは呼び出されません。 | 
| OnStateEnter | Called on the first Update frame when a state machine evaluate this state. | 
| OnStateExit | Called on the last update frame when a state machine evaluate this state. | 
| OnStateIK | MonoBehaviour.OnAnimatorIK の直後に呼び出されます。 | 
| OnStateMove | MonoBehaviour.OnAnimatorMove の直後に呼び出されます。 | 
| OnStateUpdate | 最初と最後のフレームを除いて Update フレームごとに呼び出されます。 | 
| hideFlags | Should the object be hidden, saved with the Scene or modifiable by the user? | 
| name | オブジェクト名 | 
| GetInstanceID | Gets the instance ID of the object. | 
| ToString | Returns the name of the object. | 
| Destroy | Removes a GameObject, component or asset. | 
| DestroyImmediate | Destroys the object obj immediately. You are strongly recommended to use Destroy instead. | 
| DontDestroyOnLoad | Do not destroy the target Object when loading a new Scene. | 
| FindAnyObjectByType | Retrieves any active loaded object of Type type. | 
| FindFirstObjectByType | Retrieves the first active loaded object of Type type. | 
| FindObjectsByType | Retrieves a list of all loaded objects of Type type. | 
| Instantiate | original のオブジェクトをクローンします | 
| CreateInstance | ScriptableObject のインスタンスを作成します。 | 
| bool | オブジェクトが存在するかどうか | 
| operator != | 二つのオブジェクトが異なるオブジェクトを参照しているか比較します | 
| operator == | 2つのオブジェクト参照が同じオブジェクトを参照しているか比較します。 | 
| Awake | ScriptableObject スクリプトを開始するとき、この関数は呼び出されます。 | 
| OnDestroy | ScriptableObject が破棄されるとき、この関数は呼び出されます。 | 
| OnDisable | ScriptableObject クラスのオブジェクトがスコープを外れるとき、この関数は呼び出されます。 | 
| OnEnable | オブジェクトがロードされたとき、この関数は呼び出されます。 | 
| OnValidate | Editor-only function that Unity calls when the script is loaded or a value changes in the Inspector. | 
| Reset | デフォルト値にリセットします |