#Can jobs spawn other jobs?
1 messages · Page 1 of 1 (latest)
no and you wouldn't want that anyway - scheduling of job is costly
I want schedule Y parallel spawn jobs from X spawners, what is the best pattern for this? Inline a 'job' within the ISystem OnUpdate by running a query for the X spawners? Then ScheduleParallel the Y spawn jobs?
YOu can't schedule jobs from within jobs. Scheduling is main thread only
you should never rely on loop of jobs in general
because it's slow and 99% of time can be done within just one job
Sounds like the correct approach would be to have a single system per spawner, and to schedule a single job to instantiate all prefabs from a loop within the job?
If I'm spawning > 100k entities. Would not having spawn logic run concurrently be beneficial? Though I do guess the instantiate calls get queued on the parallel writer ecb. So I guess it would depend how much compute is being used before the instantiate.
no
one system/job per all spawners
that would be correct approach
and most perfomant one
for really large quantities of instantiating, its fastest to use the entitymanager with a nativearray over an ecb