protected override void OnUpdate() { float dt = Time.deltaTime; var requestArray = RequestGroup.ToComponentDataArray <SkillSpawnRequest>(Allocator.TempJob); if (requestArray.Length == 0) { requestArray.Dispose(); return; } var requestEntityArray = RequestGroup.ToEntityArray(Allocator.TempJob); // Copy requests as spawning will invalidate Group var requests = new SkillSpawnRequest[requestArray.Length]; for (var i = 0; i < requestArray.Length; i++) { requests[i] = requestArray[i]; PostUpdateCommands.DestroyEntity(requestEntityArray[i]); } for (var i = 0; i < requests.Length; i++) { } requestEntityArray.Dispose(); requestArray.Dispose(); }
public static void Create(EntityCommandBuffer commandBuffer, long UID, int SkillID) { var data = new SkillSpawnRequest(UID, SkillID); var entity = commandBuffer.CreateEntity(); commandBuffer.AddComponent(entity, data); }