Hello,
I want to add behavior and in this behavior add a script, but i can’t use the methode AddStateMachineBehaviour.
I already script the creation of my animator controller and my state with my motion (“be_hit.anim”) but i can’t add my script (HandleMovementCollider.cs) in the state.
Can anyone help me use this method or use anything else that can do the same thing ?
AnimationClip test = AssetDatabase.LoadAssetAtPath("Assets/Animations/Test/be_hit.anim", typeof(AnimationClip)) as AnimationClip;
MonoScript test2 = AssetDatabase.LoadAssetAtPath("Assets/Scripts/HandleMovementCollider.cs", typeof(MonoScript)) as MonoScript;
var controller = UnityEditor.Animations.AnimatorController.CreateAnimatorControllerAtPath ("Assets/Animations/test.controller");
var Locomotion = controller.AddMotion(test); // don’t add an entry transition, should entry to state by default
Locomotion.AddStateMachineBehaviour(MonoScript); //This doesn't work
Sorry for bad english