Whenever I try to read and or set certain properties of my animation tree state machine, they return null or don’t work because I tried setting a property of a null object.
In this line I am trying to see the blend position of a blend space I set up in an animation tree. This animation tree is an exported variable set in the editor. This line is inside the process function.
When I run the project, the output looks like this.
Every other frame the output is null, and it happens with many properties. This is a major problem because setting properties in ready doesn’t work because everything is null.
I haven’t seen this documented anywhere else, any help is appreciated.
I found that the issue seems to be with the fact that the script this is running in is a class_name script, in this case called Actor. It should also be noted that “anim_tree” is an exported variable in which I assign an Animation Tree.
When I run this code in another script attached to an actor node, this issue does not happen, though I do not understand why.
I assume that process is not meant to run twice like this, as putting a process function in player.gd seems to take priority over the process in the actor_class script.
It does not matter how many times you try to get the value in a frame, it should not fail.
The only way I can see that failing is that a node/scene was probably assigned an AnimationTree which does not have that parameter. Like, if you have 2 scenes that use the same script Actor but each one has assigned different AnimationTrees
I only have one Actor currently, and the problem has now progressed to the whole animation tree being null upon running the main scene. I feel it has to do with the fact that the animation tree is an exported variable.
I’m now getting an error where the animation tree is null entirely on runtime. The state machine can’t be loaded because you can’t use get() on a null value.