11-23-2023 11:47 PM
I am currently producing the project using the XR interaction Toolkit.
The problem is that the Spatial Anchor function doesn't seem to work.
So here is my code :
private OVRSpatialAnchor _spatialAnchor;
...
/// <summary>
/// UI callback for the anchor menu's Save button
/// </summary>
public void OnSaveLocalButtonPressed()
{
if (!_spatialAnchor) return;
_spatialAnchor.Save((anchor, success) =>
{
if (!success) return;
SaveUuidToPlayerPrefs(anchor.Uuid);
});
}
I looked for the "Save" method because the save method did not call the defined callback.
So I searched for the method and went into it.
Save(Action<OVRSpatialAnchor, bool> onComplete = null),
public static void ContinueTaskWith(OVRTask<TResult> task, Action<TCapture, TResult> onCompleted,
TCapture state),
public void ContinueWith<T>(Action<TResult, T> onCompleted, T state)
The problem is OVRTask.ContinueWith
public void ContinueWith<T>(Action<TResult, T> onCompleted, T state)
{
ValidateDelegateAndThrow(onCompleted, nameof(onCompleted));
if (IsCompleted)
{
onCompleted.Invoke(GetResult(), state);
}
else
{
CallbackWithState<T>.Add(_id, state, onCompleted);
}
}
That "IsCompleted" return false, So the else statement is called
It looks like the callback I sent is included in CallbackwithState, but it hasn't been called since.
the biggest problem is
THE SAME CODE WORKS FINE ON OCULUS
If you select OpenXR in XR Plug-in Management, it does not work,
but if you select Oculus, it works normally.
Does anyone know about this problem?