Unity ECS Jobs Migration from Monobehaviour Methods

I want to gradually migrate various methods in, quite a chunky, Monobehaviour to ECS Jobs in order to leverage the multithreaded aspects of that system., specifically Unity Physics DOTS.

My initial investigation involved scheduling a Physics based Job directly from a Monobehaviour, and awaited the result. The job schedule occurs on the Update method, which could be problematic when starting Jobs and waiting for the results from the previous invocation of Update. To top it off, there are multiple physics calls in and around various call stacks of this Update.

I wanted to migrate the code gradually. Can anyone offer general advice on this, specifically scheduling Jobs from Monobehaviour with focus on the Update method.

If you want to combine multithreading in mono behaviors, use the job system (if possible with burst).
ECS is a standalone architecture, which is tricky to link directly to mono behaviors.

I have scheduled the jobs in Update and then completed them in LateUpdate. This way you can let it run multithreaded and not pause the main thread much.
Here is a base setup of my work:

Join the bootcamp these days and ask questions there :stuck_out_tongue:

1 Like