State Tree Parameters of an instance cannot override the default value set in the State Tree editor

Hi everyone,

I started using State Trees and was wondering If I have encountered a bug or a limitation of what is currently supported in 5.1 for State Tree.

My setup is as followed:

  1. I set up a State Tree with a few parameters of various types
  2. Certain states in the State Tree have tasks and/or conditions that are using the parameters of the State Tree via bindings
  3. I added the StateTree to an Actor
  4. When adding the State Tree to the component of the Actor, I can see all the parameters that I defined in the State Tree editor show up in the details panel of the instance of the State Tree. However, even though I can change/override the value of the parameters, what ever is set is not reflected properly at runtime. I. E. If the default value of a parameter X was 5 and I override it to 10 in the details panel, the task/condition that is using it via binding will still receive 5 instead of 10.

With all that said, are parameter not meant/supported to be overriden on the instance ? If not, what is the point of having them show up like that ?

Thank you :slight_smile:

Hey, I just ran into this myself and it may be a bug.

Initially when the state tree is ran it had a valid value of a parameter set in an instance, but when it re-enters a node it seems like the parameter is no longer valid, like it’s not re-instancing or it’s being thrown away due to being a weak reference maybe?

In my case I’m using different EQS templates for AI pawns to patrol in different zones.

So the only workaround I suppose for now would be to either have two duplicate state trees with different parameters, multiple actors with different default parameters in the state tree component.

OR

Expose a parameter in your actor that you can access from your task in the state tree and retrieve instanced params that way.

One thing I found, is that if your actor component param is null and you override it with a value in an instance, then once a tree is complete it will revert to the default value of the BP or Class from CDO likely instead of from the instance.

While not ideal in terms of solutions maybe this provides some insight? I’m yet to see if anyone else has encountered the same issue with a fix.

I’m experiencing a related problem with parameters to State Tree Task. I’m passing an Actor parameter, and during ReceiveEnterState it’s correctly set. However, during ReceiveTick it’s all of the sudden null. Don’t have a fix unfortunately.

Kind regards,
Uffe