Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice

Resolved Unity tells me the animation controller variable has not been assigned, but it is ...

Discussion in 'Animation' started by Erenquin, Jul 11, 2021.

  1. Erenquin


    Apr 9, 2018
    The typical reason for this issue is when we forget to set the variable in the inspector.
    Fact is, I did assign the variable in the inspector.

    So, my player has a GFX object, which has the animation and controller:

    My script has the controlled assigned. And in play mode I do not see it becoming null.

    In play mode I see the relevant boolean been correctly set according to the movement input:

    That's a first place where I'm puzzled:
    If the animator is not set, how can it react to the setBool call ?

    Additionally, at the 1st movement input it starts playing the relevant animation.
    Similarly to the case above, if the animator is not set how can it start the correct animation the very 1st time ?

    Thanks for the help.
  2. Erenquin


    Apr 9, 2018
    Ok that is my second silly question of the day :/

    Actually I had the same scripts attached to a cube which I used to test the basic movements at first.
    And obviously this cube does not have a GFX component with the animations.

    The logs came from the cube rather than my actual player object.