Systems comparison
To create a system, you can use either ISystem or SystemBase. ISystem provides access to unmanaged memory, whereas SystemBase is useful for storing managed data. You can use both system types with all of the Entities package and the job system. The following outlines the differences between the two system types
Differences between systems
ISystem is compatible with Burst, is faster than SystemBase, and has a value-based representation. In general, you should use ISystem over SystemBase to get better performance benefits. However, SystemBase has convenient features at the compromise of using garbage collection allocations or increased SourceGen compilation time.
The following table outlines their compatibility:
| Feature | ISystem compatibility | SystemBase compatibility |
|---|---|---|
Burst compile OnCreate, OnUpdate, and OnDestroy |
Yes | No |
| Unmanaged memory allocated | Yes | No |
| GC allocated | No | Yes |
| Can store managed data directly in system type | No | Yes |
Idiomatic foreach |
Yes | Yes |
Entities.ForEach |
No | Yes |
Job.WithCode |
No | Yes |
IJobEntity |
Yes | Yes |
IJobChunk |
Yes | Yes |
| Supports inheritance | No | Yes |
Multiple system instances
You can manually create multiple instances of the same system type in a World at runtime and track the SystemHandle for each instance. However, general APIs such as GetExistingSystem and GetOrCreateSystem don't support multiple system instances.
You can use the CreateSystem API to create runtime systems.