/// <summary> /// Function used to query for found objects present in the real world. /// </summary> /// <param name="parameters">The parameters to use for this query.</param> /// <param name="callback">The function to call when the query is done.</param> public static MLResult QueryFoundObjects(MLFoundObjects.QueryResultsDelegate callback) { if (MLFoundObjects.IsStarted) { if (IsQuerying) { return(MLResult.Create(MLResult.Code.UnspecifiedFailure, "A previous query is still in progress.")); } callback += queryCallback; result = MLFoundObjects.GetObjects(callback); IsQuerying = result.IsOk; if (!result.IsOk) { callback = null; Debug.LogErrorFormat("Error: MLFoundObjectsStarterKit.QueryFoundObjects failed. Reason: {0}", result); } } else { Debug.LogError("Error: MLFoundObjectsStarterKit.QueryFoundObjects failed because MLFoundObjects was not started."); result = MLResult.Create(MLResult.Code.UnspecifiedFailure, "MLFoundObjects was not started"); } return(result); }
/// <summary> /// Requests a new query if one is not currently active. /// </summary> /// <returns>Will return true if the request was successful.</returns> public bool QueryFoundObjects() { #if PLATFORM_LUMIN if (MLFoundObjects.IsStarted) { MLFoundObjects.GetObjects(HandleOnFoundObject); return(true); } #endif return(false); }