Is this how you check a value and set it on like an update function? In a script I would just get velocity and set the mechanim parameter on every update, and I am trying to find a proper way to do this through behavior trees. Do you think something like this should be done in trees? or should it be done through code.
You can see in this pic, the name is exactly the same, RunSpeed. But its never set, it never changes from the behavior tree. How come?
Hello and sorry for the late reply.
It is really fine to do it within Behaviour Trees similar to what you are doing now.
One thing I usually suggest as well for Animator Parameters, is to make use of Data Bound Variables and create a simple script with properties to bound variables to, acting as a bridge.
For example, you can have a script like this attached on the same gameobject as the Blackboard and GraphOwner is:
Then you will be able to bind a blackboard variable directly to this property and as such, whenever you set the blackboard variable, the property setter will be called whereas whenever you get the blackboard variable, the property getter will be called.
This way, you can completely avoid using the Mecanim based Actions, but instead get/set the variable (thus the property and thus the animator parameter) quicker and easier.
You can of course expand this script adding more properties for more parameters.
Let me know if that helps or if you have any other questions.
Thanks!