Behavior Graph: 2 target logic is getting stuck

Issue:
Behavior Graph logic for chasing two targets is not working.

Detailed Description:
I am working on a game where there are two players, and monsters are advancing. Monsters start chasing/attacking a player if they detect a player. When there is only one player, the target logic worked fine, but I tried making a graph that handles detecting 2 targets and it is not working.


Note: I couldn’t add a picture of the branch that checks if targets are detected and sets the Player1Detected and Player2Detected booleans because of the this sites’ restrictions, but it doesn’t seem like the error is coming from there and was working fine for the previous behavior with just one target.

My idea:
It first tries to see if targets are detected, then it goes into a branch that checks:
If both targets detected then pick a random target to chase/attack.
else if target1 detected but not target2 chase/attack target1
else if target2 detcted but not target1 chase/attack target2

Not working: For some reason, when launching the debugger, it doesn’t seem to indicate that it is ever entering the first branch (both targets detected). So even if on the game it says players are being detected, the monster doesn’t move and stays stuck.

Does anyone know why the behavior graph is blocking in this logic? This is my first time using Unity so I’m struggling to understand the logic.

Hi @totorobighouse,

If the first subtree/branch is never seen executed, it probably means that a condition or node fails and the TryInOrder jump to the following subtree.

Try adding a Wait frame at the start of each branch of the TryInOrder (so just before the Condition and Abort). The debugger currently only refresh once per frame after the graph has ticked. It does reflect the state of the graph after the graph update and doesn’t have a “persistence” over all the nodes that have been executed during the frame.

Thank you so much! This helped resolve the issue