ゲームオブジェクトにアタッチされたAnimatorのステートとパラメータを選択可能にするエディタ拡張を作りました。
下記のように書くとAnimatorに含まれるステートやパラメーターがインスペクターに表示されます。
public class TestBehaviour : MonoBehaviour { public AnimatorStateName State; public AnimatorParameterName Property; }
内部的にはハッシュ値で保持しているので軽量です。
[System.Serializable] public struct AnimatorStateName { [SerializeField] internal int m_Hash; }
構造体はそのままAnimatorのAPIに渡せます。
m_Animator.Play(State); m_Animator.SetInteger(Property, 15);
ダウンロードはこちら
https://gist.github.com/takazerker/335b7769db45c2cebccbbf5bf43bafe4