Job system in Entities introduction
The Entities package uses the job system to create multithreaded code. If you're concerned about performance, use jobs whenever possible.
The following techniques are available, depending on the type of access you require:
- Job scheduling: For convenient job scheduling, use
IJobEntity
. For more information, refer to Iterate over component data in multiple systems. - Manual scheduling outside the main thread: Use
IJobChunk
'sSchedule()
andScheduleParallel()
methods to transform data outside the main thread.
When you schedule jobs, ECS keeps track of which systems read and write which components. Later systems' Dependency
property include the job handles of earlier systems' scheduled jobs, in cases where the set of components' read and write operations overlap. For more information, refer to Job dependencies.
For main thread access outside of the job system, use a foreach
statement over the Query
objects in SystemAPI
. For more information, refer to SystemAPI overview.