Trouble with AnimationTree with setting parameters

Godot Version

Godot 4.2.2

in the photo below is my animation script. I have the script on a grey node part of the player character scene. When I run my game to see if the animations work properly for walking and idle the game crashes and gives me this error that i circled.

I have tried a couple things like putting the parameter change in a function and calling the function, running it as you see in the photo, and even trying the animated sprite. I can’t seem to figure out who I cant set the parameters. I also have an example game that I am using as an example to help me learn what i am doing here lol and that code is written like this one.

The error states that your animation tree is not set. have you assigned the export variable in your Player02?

Its just easier to share screenshots. This is my player02 node on the left and the code for player_02.gd

Ah, sorry I didn’t realize what node this was attached to. Your PlayerAnimation node is missing it’s animationTree assignment

The script in the first picture is attached to a grey node, and the script in the second picture is attached to my characterbody2d node. I’m not quite following what you mean by missing its assignment

When you use @export it allows the variable to be assigned through the inspector. For example your last screenshot with the Player02 (I thought the original script was attached here) has “Anim Tree” assigned in the inspector, relating to the @export var animTree. So, your node “PlayerAnimation” with the original script also has a @export for animationTree, but it’s null, so it must not be assigned.

I looked through the nodes and you were right. I never assigned the animationtree and the sprite in the greynode that controls the animations. Thank you so much dude! youre a real one

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.