public override void SendCommands(SpatialOSSendSystem sendSystem, global::Improbable.Worker.Core.Connection connection) { var entityType = sendSystem.GetArchetypeChunkEntityType(); { var senderType = sendSystem.GetArchetypeChunkComponentType <Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFieldsWithCommands.CommandSenders.Cmd>(true); var responderType = sendSystem.GetArchetypeChunkComponentType <Improbable.Gdk.Tests.ComponentsWithNoFields.ComponentWithNoFieldsWithCommands.CommandResponders.Cmd>(true); var chunks = EntityManager.CreateArchetypeChunkArray(CommandQueries[0], Allocator.TempJob); foreach (var chunk in chunks) { var entities = chunk.GetNativeArray(entityType); var senders = chunk.GetNativeArray(senderType); var responders = chunk.GetNativeArray(responderType); for (var i = 0; i < senders.Length; i++) { var requests = senders[i].RequestsToSend; var responses = responders[i].ResponsesToSend; if (requests.Count > 0) { foreach (var request in requests) { var schemaCommandRequest = new global::Improbable.Worker.Core.SchemaCommandRequest(ComponentId, 1); global::Improbable.Gdk.Tests.ComponentsWithNoFields.Empty.Serialization.Serialize(request.Payload, schemaCommandRequest.GetObject()); var requestId = connection.SendCommandRequest(request.TargetEntityId, new global::Improbable.Worker.Core.CommandRequest(schemaCommandRequest), request.TimeoutMillis, request.AllowShortCircuiting ? ShortCircuitParameters : null); cmdStorage.CommandRequestsInFlight[requestId.Id] = new CommandRequestStore <global::Improbable.Gdk.Tests.ComponentsWithNoFields.Empty>(entities[i], request.Payload, request.Context, request.RequestId); } requests.Clear(); } if (responses.Count > 0) { foreach (var response in responses) { var requestId = new global::Improbable.Worker.Core.RequestId <IncomingCommandRequest>(response.RequestId); if (response.FailureMessage != null) { // Send a command failure if the string is non-null. connection.SendCommandFailure(requestId, response.FailureMessage); continue; } var schemaCommandResponse = new global::Improbable.Worker.Core.SchemaCommandResponse(ComponentId, 1); global::Improbable.Gdk.Tests.ComponentsWithNoFields.Empty.Serialization.Serialize(response.Payload.Value, schemaCommandResponse.GetObject()); connection.SendCommandResponse(requestId, new global::Improbable.Worker.Core.CommandResponse(schemaCommandResponse)); } responses.Clear(); } } } chunks.Dispose(); } }