Feature Request. Make struct CleanupEntity public

Motivation: to access reactive entities with IJobForEachWithEntity to get ISystemStateBufferElementData or to react on that with IJobForEach<T, CleanupEntity>

Example:

    [RequireComponentTag(typeof(NetworkEvent))]
    public struct ServerReactiveJob : IJobForEachWithEntity<CleanupEntity>
    {
        [NativeDisableParallelForRestriction]
        [ReadOnly]
        public BufferFromEntity<NetworkEvent> NetworkEventBufferArray;

        public void Execute(Entity entity, int index, [ReadOnly] ref CleanupEntity cleanupEntity)
        {
            var buffer = NetworkEventBufferArray[entity];

           // Do work for each of the destroyed entities.
        }
    }

Hm, I think you want a IJobForEach having a IBufferElement overload too :slight_smile:

… but, yes, some stuff would be simpler if CleanupEntity was public. Eg adding a SystemState component to a referenced entity without having any non-system state component to detect deletion or just to make SystemState component cleanup independent of which other component creation was triggered by.

1 Like

I think @AriaBonczek works on it now