Search Unity

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

    Erenquin

    Joined:
    Apr 9, 2018
    Posts:
    164
    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:
    upload_2021-7-11_17-10-17.png

    My script has the controlled assigned. And in play mode I do not see it becoming null.
    upload_2021-7-11_17-10-52.png

    In play mode I see the relevant boolean been correctly set according to the movement input:
    upload_2021-7-11_17-12-25.png

    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

    Erenquin

    Joined:
    Apr 9, 2018
    Posts:
    164
    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.