Failing to reset Wait for all and other flow nodes when calling Reset node or OnStartEvent (Restart)

I have a small tree that waits for some user input before triggering a switch statement that diverts the flow depending on input. My intention is to reset the branch when a specific event or variable changes so that the flow can be re-run as a clean slate.

I have tried to fix my issue in several ways with no success, but my current implementation consists of some events and blackboard variables that I use to control the flow to wait for some user interactions.

The branches that run in a, sort of timeline format, trigger some logic in parallel runs with some [Wait] nodes and after all of these action nodes, there is a [Wait for all] node that then, triggers some other nodes with similar logic and arrangements. At the very end, I have an event that triggers the user interaction flow again.

The user interacts again with some UI and after this happens, the leaf sends an event that (supposedly) restarts my logic branch and restarts the whole flow again.

The main issue is that, after one loop, the debugger shows all the flow nodes as success (the checkmark icon) and nothing gets awaited. It all runs at the same time and some nodes even get run and started more than once.

Is this a bug or am I doing something incredibly wrong.

PD: I have tried the reset node with some conditionals without success. I am making sure that all the child nodes are finished before re-triggering them and there is no repeat nodes.

Hi @AlejandroGamezS ,

I’m sorry you’re having an issue with this. Can you share a picture of an example graph where you’re encountering this problem for us to look at?

I believe @davidlovegrove is working on fixing something to do with Wait For Any node right now, I wonder if it might be related :thinking:

If you can also open a bug for us, that’d be great! That way you can follow the progress and we get QA support to follow through the steps: https://support.unity.com/hc/en-us/articles/206336985-How-do-I-submit-a-bug-report

Hey @ShaneeNishry! Thank you for the reply.

Yes, I’m including some screenshots of the behavior graph. I will also include some with it running in debug to showcase the issue. I’ll open a Ticket shortly and post as well.

The Screenshot showcases a version of this that is a bit disorganized because of the testing that I have been doing. In reality, all these modes are running in separate behavior subgraphs, but for testing I copied one of the subgraphs directly to the master graph to see it in action, with the debugger.

Start and User input side of the graph:

Logic flow and subgraph triggers:

Mode SubGraph (Pasted into master graph for debugging):

Subgraph during the first run (Works as expected):

Subgraph after the first run (Works as expected)

Subgraph after first reset (Probably not working as expected):

Subgraph after reset and re-trigger (Not working as expected) (Nodes pointed by yellow arrows run multiple times randomly):

Please let me know if you need more info.
Thank you for the support!

Hi @AlejandroGamezS , thank you so much for the reply and the screenshots! I believe this is the same issue we’re already looking into so hopefully we can get you a fix soon. Unfortunately it probably won’t be available for tomorrow’s release as we will need to test it thoroughly :confused:

I’m sorry for the inconvenience with that and will communicate as soon as we have something for you.

Hi @AlejandroGamezS ,

David and I took the time to debug it together since my last message and may have found a fix! It might come out tomorrow after all :slight_smile:

1 Like

Thank you @ShaneeNishry and @davidlovegrove !

That would be amazing.

We need it urgently for a customer project. So please let me know if I can help testing something or in any way.

BTW, I have opened a ticket here

Perfect, thank you!

We actually think the fix is quite simple, in ParallelWaitComposite.cs, the OnEnd for WaitForAllComposite instead of decrementing m_StartCount, set it to 0 by default.

1 Like

I’ve just tested it and that seems like it does the job.
Thank you!

I’ll wait for the official update then, but good to know the fix is simple enough.

Awesome! Thank you for verifying and for all the information :slight_smile: