Big change coming to Behavior Package (delayed node execution fix)

Hey all,

A big change is coming to Behavior. As some of you have noticed, nodes often have their Update() call deferred to the next frame. This upcoming change will remove this behavior and ensure all nodes run on the same frame when they should.

Note that this means your entire graph can run in a single frame if none of its nodes return Status.Running on their Update and and finishes its operation entirely. This could potentially cause infinite loops. To mitigate that, we added 2 things:

  • A safety check that if your graph is ticking for over a second, we’ll abort operation and give you an error telling you there might be an infinite loop or an extremely expensive operation.
  • We’ve added a WaitFramesAction which will wait until the chosen number of frames have elapsed. This allows you to add yields in graphs that you expect to execute entirely.

This change brings a big improvement in graph execution and addresses an issue multiple users asked for. As you may expect, this also brings a bit of risk. I’ve tested this quite thoroughly during the work on the PR and worked on our automated testing quite a bit, so I am hopeful this should land smoothly. That said, I apologise in advance if anything has slipped our testing.

We (the Behavior team, not the Royal Me) are hopeful we can release this change in 1.0.8 tomorrow or the day after, but this all depends on our QA process. It could be that this will be delayed for 1.0.9 (hopefully in 2 weeks time).

As always, we welcome your feedback and are hopeful we’re moving in the right direction to deliver an excellent package for you that will bring you utility and use and make using Unity easier and more fun. Please keep the feedback coming!

Thanks,
~ The Behavior Team.

8 Likes

Amazing news!
This change can push Behavior Graph beyond just a tool to a completely new paradigm of handling scripts and data in the engine. Thanks to the amazing new demo showing that Behavior can be used for absolutely everything, completely (or mostly) replacing MonoBehaviours, basically this is MonoBehaviour 2.0.

Question: Currently if Start On Event Message receives 2 invocations on the same frame, one call will be ignored in child nodes (if SOEM’s mode is Restart, will be ignored in nodes after the first child node, given all child nodes are instant Status.Success), will this change fix this, allowing the same instant branch to be executed multiple times per frame?

Hey ShaneeNishry, hope you’re doing well! any updated on this?