Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Bug Character speed increased with override animation

Discussion in 'Animation' started by zMuku, May 5, 2024.

  1. zMuku


    Dec 27, 2014
    Edit 2: It seems to be happening because of the line:
    Code (CSharp):
    1. character.applyRootMotion = applyRootMotion;
    Edit: I removed the Avatar Mask and the weight of the Upperbody Override and the issue persists so now I'm thinking its not specific to the layer itself.

    I have a character that uses the override mask on a separate Animator Layer but anytime that animation gets called (Or when the game starts up) my characters velocity increases until I perform a different action. After a different action is called my character speed resets to its default values.

    I should note that the other animations call the same function to play their animations as my override.

    I'm unsure if this is animator specific given that it happens up start up but I can only recreate it if the override animation is called again. If I comment out the line that calls the override animation the character spawns with the correct velocity.

    This is my Avatar Mask

    Animator Layers

    Code that calls my animation function
    Code (CSharp):
    1. player.playerAnimatorManager.PlayTargetActionAnimation("Swap_Right_Weapon01", false, true, true, true);
    Code to play animations
    Code (CSharp):
    1.         public virtual void PlayTargetActionAnimation(
    2.             string targetAnimation,
    3.             bool isPerformingAction,
    4.             bool applyRootMotion = true,
    5.             bool canRotate = false,
    6.             bool canMove = false)
    7.         {
    8.             character.applyRootMotion = applyRootMotion;
    9.             character.animator.CrossFade(targetAnimation, 0.2f);
    11.             character.isPerformingAction = isPerformingAction;
    12.             character.canRotate = canRotate;
    13.             character.canMove = canMove;
    15.             // Tell the server/host we played an animation, and to play that animation for everybody else present
    16.             character.characterNetworkManager.NotifyTheServerOfActionAnimationServerRpc(NetworkManager.Singleton.LocalClientId, targetAnimation, applyRootMotion);
    17.         }

    Attached Files:

    Last edited: May 5, 2024