popcorn/Scripts/Extensions/AnimatorExtensions.cs

17 lines
428 B
C#
Raw Normal View History

using UnityEngine;
using System;
public static class AnimatorExtensions {
/// GetBehaviourで取得出来ればfuncに渡す
public static bool FindBehaviour<T>(this Animator t, Action<T> func) where T : StateMachineBehaviour {
T behaviour = t.GetBehaviour<T>();
if(behaviour != null){
func(behaviour);
return true;
}else{
return false;
}
}
}