Home

Awesome

com.bovinelabs.entities

Systems

EntityEventSystem

https://forum.unity.com/threads/batch-entitycommandbuffer.593569/

Easily create lots of events extremely efficiently.

How to use

Instead of using a EntityCommandBuffer, we get a NativeQueue<T> from CreateEventQueue where T is IComponentData, the event data.

NativeQueue<T> EntityEventSystem.CreateEventQueue<T>(JobComponentSystem componentSystem)

It is safe to pass this queue to Jobs, using ToConcurrent() for parallal jobs. Once you have this queue, to create an event simply create, set and add a new type of T to the queue and the EntityEventSystem will handle the rest for you.

The EntityEventSystem will batch create create entities for all these components and then set the component data.

Things to know

CreateBufferEvent

void CreateBufferEvent<T, TB>(T component, NativeArray<TB> buffer)

Works similar to CreateEventQueue except it will add a component T and BufferArray<TB> to the entity.

Note: you do not need to worry about disposing the NativeArray<TB> as this will be done for you.

Containers

Extensions