public void Playback(EntityCommandBufferSystem entityCommandBufferSystem) { if (commandBuffer.Count <= 0) { return; } var entityCommandBuffer = entityCommandBufferSystem.CreateCommandBuffer(); var createEntity = Entity.Null; while (commandBuffer.Count > 0) { var commandData = commandBuffer.Dequeue(); if (commandData.command == Command.CreateEntity) { createEntity = entityCommandBuffer.CreateEntity(); } else { var entity = commandData.entity == Entity.Null ? createEntity : commandData.entity; if (commandData.command == Command.Add) { entityCommandBuffer.AddComponent(entity, commandData.data); } else if (commandData.command == Command.Remove) { entityCommandBuffer.RemoveComponent <T>(entity); } else if (commandData.command == Command.Set) { entityCommandBuffer.SetComponent(entity, commandData.data); } else if (commandData.command == Command.AddDestroyMessage) { entityCommandBuffer.AddComponent <OnDestroyMessage>(entity); } } } }
public void Playback(EntityCommandBufferSystem entityCommandBufferSystem, JobHandle inputDeps) { inputDeps.Complete(); Playback(entityCommandBufferSystem); }