What problem does it solve?
It solves the performance and timing issues of enabling/disabling entities in Unity DOTS by letting you read and write the enabled bit of an IEnableableComponent directly inside a job execution path, avoiding ECB overhead and the one-frame delay from deferred playback.
Core Features & Use Cases
- Inline enabled-bit reads/writes in IJobEntity: Use EnabledRefRW<T> to update the component enabled state within the same job pass.
- Correct query behavior with disabled entities: Ensure queries include disabled entities by using EntityQueryOptions.IgnoreComponentEnabledState when you intend to process both enabled and disabled targets.
- Same-frame bulk toggling: Apply proximity/LOD/range logic to bulk-enable or bulk-disable entities without structural changes or ECB playback.
Use case: you have thousands of entities and need proximity-based culling that turns an ActiveBehavior component on/off immediately within the same frame based on distance computed during the job.
Quick Start
Use EnabledRefRW<ActiveBehavior> inside an IJobEntity Execute method and add WithOptions(EntityQueryOptions.IgnoreComponentEnabledState) so the job can process both enabled and disabled entities in the same pass.