pvanallen / delft-ai-toolkit

Tool for Prototyping AI Projects
30 stars 3 forks source link

DingControlVirtual sending and receiving events causes Unity crash #10

Closed pvanallen closed 5 years ago

pvanallen commented 5 years ago

If a graph is set up to start a virtual robot to send "analogin" with a condition listening to it, when control is passed from the condition to an action node, Unity crashes. See gif for example.

I tried several variations:

So it seems there is some weird interaction between the action node sending an event and the virtual robot sending a signal???

signalcrash

pvanallen commented 5 years ago

screenshot_1_19_19__10_17_am

Siccity commented 5 years ago

Could you commit your scene and graph to a separate "bug" branch? I'm having a hard time replicating it on my end

pvanallen commented 5 years ago

Okay, the bug test "eventcrash" graph is committed to the bug branch. It uses the "Main" scene that's already there. Tested on a Mac, with 2018.2.18 and 2018.2.20f1.

To reproduce, click on "Trigger" on the first Actions node. Once the Float Condition node receives input from the Ding Virt that's greater than the trigger condition, Unity either crashes completely, or hangs.

Just in case it would be useful, I've attached the crash report eventcrashreport.txt

pvanallen commented 5 years ago

Progress - There must be some kind of race condition between events in action nodes and DingControlVirtual and condition nodes? If I introduce a very short delay before actions start executing in Actions.cs the crash stops happening. On lines 41/42 of Actions.cs I put in this delay in this bug branch, but this is not an ideal place due to the recursive use of the the NextAction() function.

@Siccity, can you take a look and find a better place to introduce a delay so when the Enter()/OnEnter() is called (at least in action nodes, but maybe in all nodes?) it waits a moment so an event isn't sent out while the previous node is still active (due to the structure of the code, the previous node is still active while it is notifying the next nodes to become active -- at least in the condition nodes).

Siccity commented 5 years ago

It was hard for me to track down, but I found a fix :)

pvanallen commented 5 years ago

Nice! Thanks.