Tip for SpinAction; and at first I couldn't reproduce the issue shown at 5:00

While I did understand from the video what the issue about having several actions active at the same time was, I just couldn’t get my project to show it like the lesson’s video does at about 5:00 minutes. In my project the SpinAction just continued to work.

Eventually I found out what I did that caused it:
In the MoveAction in the else block where the animation stops, I also had a line to align the unit’s position to be exactly the target position:

        else
        {
            unitAnimator.SetBool(IS_WALKING, false);
            transform.position = targetPosition;
        }

When I commented out the assignment of the targetPosition the issue with the spin action appeared, just as it was demonstrated in the video.

Another thing I did in the SpinAction was that I protected triggering it when it’s already active, so that a currently ongoing spind couldn’t be interrupted and the target rotation becoming what the rotation value happened to be at the moment the extra spin was triggered:

    public void Spin()
    {
        if (isActive)
        {
            return;
        }
        isActive = true;
        totalSpinAmount = 0f;
    }

Privacy & Terms