/// <summary> /// Sends an EntityQuery command request. /// </summary> /// <param name="entityQuery">The EntityQuery object defining the constraints and query type.</param> /// <param name="timeoutMillis"> /// (Optional) The command timeout in milliseconds. If not specified, will default to 5 seconds. /// </param> /// <param name="context"> /// (Optional) A context object that will be returned with the command response. /// </param> /// <returns>The request ID of the command request.</returns> public long EntityQuery(Improbable.Worker.Query.EntityQuery entityQuery, uint?timeoutMillis = null, object context = null) { if (!VerifyNotDisposed()) { return(-1); } var request = WorldCommands.EntityQuery.CreateRequest(entityQuery, timeoutMillis, context); entityManager.GetComponentData <EntityQuery.CommandSender>(entity) .RequestsToSend.Add(request); return(request.RequestId); }
/// <summary> /// Sends an EntityQuery command request. /// </summary> /// <param name="entityQuery">The EntityQuery object defining the constraints and query type.</param> /// <param name="callback"> /// A callback that will be called with the command response. /// </param> /// <param name="timeoutMillis"> /// (Optional) The command timeout in milliseconds. If not specified, will default to 5 seconds. /// </param> /// <returns>The request ID of the command request.</returns> public long EntityQuery(Improbable.Worker.Query.EntityQuery entityQuery, Action <EntityQuery.ReceivedResponse> callback, uint?timeoutMillis = null) { if (!IsValid()) { return(-1); } var request = WorldCommands.EntityQuery.CreateRequest(entityQuery, timeoutMillis, callback); entityManager.GetComponentData <EntityQuery.CommandSender>(entity) .RequestsToSend.Add(request); return(request.RequestId); }