Topic: Standing Up Crouching Down Clip Script (UFE 2.4.1 Bug Workaround)

In UFE 2.4.1 there is two issues with standing up and crouching down clips
You might have encountered these issues
1. standing up and crouching down clips repeat the first frame
2. crouch idle doesn't play after a move

Without Bug Workaround script
https://i.imgur.com/MmRg74Q.gif

With Bug Workaround script
https://i.imgur.com/feA8Sk1.gif

Add this script to your UFE character prefab

using UnityEngine;
using UFE3D;

public class UFE_2StandingUpCrouchingDownClipHandlerScript : MonoBehaviour
{
    private ControlsScript myControlsScript;

    private PhysicsScript myPhysicsScript;

    private MoveSetScript myMoveSetScript;

    private MecanimControl myMecanimControl;

    // Start is called before the first frame update
    void Start()
    {
        myControlsScript = GetComponentInParent<ControlsScript>();

        if (myControlsScript != null)
        {
            myPhysicsScript = myControlsScript.Physics;

            myMoveSetScript = GetComponent<MoveSetScript>();

            myMecanimControl = myMoveSetScript.MecanimControl;
        }            
    }

    // Update is called once per frame
    void Update()
    {
        if (myControlsScript != null)
        {
            if (myControlsScript.currentMove == null
                && myControlsScript.currentState == PossibleStates.Crouch
                && myControlsScript.currentSubState != SubStates.Stunned
                && myControlsScript.currentSubState != SubStates.Blocking
                && myMecanimControl.currentAnimationData.clipName != "crouching_2"
                && myMecanimControl.currentAnimationData.clipName != "blockingCrouchingPose"
                && myMecanimControl.currentAnimationData.clipName != "blockingCrouchingHit"
                && myMecanimControl.currentAnimationData.clipName != "parryCrouching"
                && myMecanimControl.currentAnimationData.clipName != "getHitCrouching")
            {
                if (myMecanimControl.currentAnimationData.clipName != "crouching")
                {
                    myMoveSetScript.PlayBasicMove(myMoveSetScript.basicMoves.crouching, false);
                }
            }

            if (myMecanimControl.currentAnimationData.clipName == "crouching_2" && myMecanimControl.currentAnimationData.timesPlayed >= 1)
            {
                myMecanimControl.currentAnimationData.normalizedTime = 1;
                myMecanimControl.Refresh();
            }

            if (myMecanimControl.currentAnimationData.clipName == "crouching_3" && myMecanimControl.currentAnimationData.timesPlayed >= 1)
            {
                myMecanimControl.currentAnimationData.normalizedTime = 1;
                myMecanimControl.Refresh();
            }
        }   
    }
}

Share

Thumbs up Thumbs down

Re: Standing Up Crouching Down Clip Script (UFE 2.4.1 Bug Workaround)

You're a lifesaver! Thanks!

Share

Thumbs up +2 Thumbs down