Data flow of tasks in State Trees

Hello there,

I have a questiona bout the data flow and the availability of that data in a state tree.

For this I refer to this article / documentation page.

In it we see this example:

The selector state (“Smart Objects”) seems to clam a smart object that the leaf state then use. That might even work fine (although currently I have no way to verify if that is always the case) but it is a good example to illustrate my question.

When the “Reach” or “Use” states are selected, their parent / selector state “Smart Objects” is also selected. Then all the task for all the currently active states run concurrently. (Its stated in the article and my observations seem to confirm that)

So ZG Claim SmartObject and FindSO Target & Move To SO & Look both run concurrently.

We also know that leaf states can access data of other tasks up the tree, so FindSO Target & Move To SO & Look can access (and probably does) the smart object claimed in ZG Claim SmartObject.

My question is: How can i make sure that the object is actually there, when I need to use it in a leaf state. Because if both tasks run concurrently, and the leaf state is faster to load the data then the selector state is to set the data, I see room for errors.

I mean I could just abort the task (or finish it unsuccessfully) if it cant access the data needed, and then loop with our without waiting, but that seems … un-elegant.

Is there a way to make sure that the leaf state is executed, with making sure the parent / selector state is done and has provided the data necessary? I mean I could put it in another leaf state but… ugh, not ideal.

Any Ideas? (and if the UE devs are listening in: maybe a feature for the future of State Trees?)

1 Like