Character does not change animation

I am learining unity, and i followed BlackThornProd's tutorial (


My script and character settings are exactly the same, and yet it doesn't change animation

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CharacterAnimation : MonoBehaviour
    private Animator anim;

    // Start is called before the first frame update
    void Start()
        anim = GetComponent<Animator>();

    // Update is called once per frame
    void Update()
        if (Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.RightArrow)) {
            anim.SetBool("isRunning", true);
        } else {
            anim.SetBool("isRunning", false);
1 Like

Is the correct animator assigned on the character In the inspector?

If you look at the animator and parameters while playing. You should see the booleans check box toggle on and off while you run and use your code. Does that happen?

If not, If you put print or debug.log statements do we know for sure the anim.set bool line is getting called?

If its getting called and the parameters still aren't updating in front of you in animator/parameters, double tripple check the spelling and letter caseing is identical. I do that sometimes in parameters, lower case letter wrong or whatever.

Any warnings or errors?

There are no warnings nor signs, and the runnig box does not change over time, only idle changes. The animation runs smoothly, but when its time to move the character the animation does not change. They are not getting called :(

As far as this question, I'm sorry to say I don't understand "If not, If you put print or debug.log statements do we know for sure the anim.set bool line is getting called?" How do I put the Debug.log on the script to check it out?

Inside the if statements, or anywhere you want to, type

print("hello, my name is nick");

And look in the console for it to read out.
Its used to know if that area od code is even being called at all

It shows nothing ._.

good, so you have started to narrow down the problem.

The code seems to be correct, but even so, to check that everything is working

      if (Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.RightArrow))
            anim.SetBool("isRunning", true);

when you play this scene. You should be reading out the print statement "hello" only when holding left or right arrow keys.
Are you sure that is not happening?

here is a picture of the console from google. Look at the bottom of your project (if default layout) and the cartoon word bubble in the top right of this pic that says 2.... click it,
you should be reading many print statmets as you are holding left and right arrows.

If not, try to print inside the Start function.
If nothing ever reads out anywhere then maybe you never assigned this script to anything in the first place

I fixed it, don't know how but suddenly it began working, didnt change a thing... so... who knows what happened. Thanks for the help :)