SetOverrideMotion() public method

Sets the override motion for the state on the given layer.

public SetOverrideMotion ( AnimatorState state, Motion motion ) : void
state AnimatorState The state which we want to set the motion.
motion UnityEngine.Motion The motion that will be set.
return void
コード例 #1
0
    void test02()
    {
        AnimatorController controller =
            AnimatorController.CreateAnimatorControllerAtPath("Assets/animation.controller");
        // Add parameters
        //controller.AddLayer("hahaha");
        AnimatorState mstate = new AnimatorState();

        mstate.name = "myState";
        Motion mmotion = Resources.Load <AnimationClip>("animation/playerClip") as Motion;

        mmotion.name = "myMotion";
        AnimatorControllerLayer myLayer = new AnimatorControllerLayer();

        myLayer.name = "hahaha";
        //myLayer.SetOverrideBehaviours(mstate,;
        myLayer.SetOverrideMotion(mstate, mmotion);
        controller.AddLayer(myLayer);
    }