imagicbell / ublockly

reimplementation of google blockly for Unity
http://imagicbell.github.io/unity/2017/10/11/blockly-one.html
Apache License 2.0
140 stars 54 forks source link

"Debug" Mode #11

Closed apoyatos closed 3 years ago

apoyatos commented 3 years ago

Hi, looking through the code we were wondering if there was a way of "debugging" the blocks( i.e stopping the execution and going block by block), and if it's not implemented we would like to know if it's possible and in that case what would we have to do. Thanks for your time.

imagicbell commented 3 years ago

Good point 👍
Currently it is not implemented. However, there might be a way to do it. The general idea is: Based on the graph structure of blocks, we can traverse all the blocks by block.next and put them in a sequence. Then run blocks in the sequence one by one. Please reference my current run logic in CSharpInterpreter.CS.

IEnumerator RunWorkspace(Workspace workspace) {...}
IEnumerator RunBlock(Block block) {...}

Also attention the loop break, continue issue, which can stop the loop block.

if (ControlCmdtor.SkipRunByControlFlow(block))
 {
    yield break;
 }

PULL REQUEST IS WELCOME~

imagicbell commented 3 years ago

Hello there, The debug mode you mentioned is on now. Please check the latest update. Thanks for your advice 😄