Hi @mastergog, the main issue is GetVirtualObjects is called within a Thread during the SceneEvaluation.
The scene Evaluation is responsible to iterate over objects/tags on the main thread and wait for each thread to be finished per priorities (this way we can ensure that an object with lower priority is correctly built otherwise you could run into huge issues. For the same reason in order to not screw the current Scene Evaluation, no other code is allowed to run in the main thread. No one wants to have its object deleted from a lambda executed on the main thread while your GetVirtualObject is currently executed within a thread.
So the main thread is blocked until all Jobs are finished, but in your case, you are also waiting for some code to be executed on the main thread so you run into the issue.
So either pass false
to the wait argument or change your design.
May I ask why do you want to execute on the main thread? It's most likely that a Message approach is doable to achieve the same things.
Please let me know,
Cheers,
Maxime.