Jobs running over multiple frames

It’s not clear for me whether allowing jobs to run over multiple frames is their intended design. I have a couple of computation intensive methods I’d like to run on separathe threads as to not block the main one. I initially settled on using C# Task library, but I would also like to benefit from Burst Compiler which seems to be made with Jobs integration in mind.

Currently I schedule jobs, store handlers in an array, then in Update method I check whether each job is completed and complete it if true (very convenient naming). Could I run into any problems with this method? And if yes, what would be right way? The documentation is not specific about it.

It’s not clear for me whether allowing jobs to run over multiple frames is their intended design.

It is. If that was not the case then the engine would communicate it by terminating jobs older than a single frame - which is not what we observe.
_

Could I run into any problems with this method?

There is just one major requirement you need to comply with: some allocation types have lifespan limits.

  • Temp is valid for just a 1 frame (but it’s allocation call is most performant one)

  • TempJob is valid for 4 frames max (doc)

  • Persistent is valid indefinitely (but it’s allocation call is most costly one)