I have a system that collects a bunch of Entity X Blocks for processing (Entity A can have 3 blocks while Entity B has only 1, etc).
I want to make the processing of said blocks to be parallel for Entities, but linear for Blocks. Is there an easy way to do it like ParallelFor(T=>T.Entity).Schedule();
Or I need to restructure my dataset and launch one job per entity?
Assign each entity a block start and block count and then iterate entities?
Well yeah, that implies restructuring the data. What I meant to ask was:
Is there a built in way to control how a list is split between threads when scheduling?
Unity isn’t indexing those arrays for you. That’s up to you to do. So you need to get those indices into your job somehow. If you don’t want to store them on entities, then you can store them in a NativeArray instead.