API reference
API reference
Select your platform
No SDKs available
No versions available

OVRTask Class

Extends IEquatable< OVRTask< TResult > >, System.IDisposable
Static methods related to OVRTask<TResult>
Represents an awaitable task.
This is a task-like object which supports the await pattern. Typically, you do not need to create or use this object directly. Instead, you can either :
- await a method which returns an object of type OVRTask<TResult>, which will eventually return a TResult
- poll the IsCompleted property and then call GetResult
- pass a delegate by calling ContinueWith(Action<TResult>). Note that an additional state object can get passed in and added as a parameter of the callback, see ContinueWith<T>
Requires the main thread to complete the await contract - blocking can result in an infinite loop.

Constructors

OVRTask ()
Signature
static OVRTask< TResult >.OVRTask()

Static Fields

_onCombinedTaskCompleted : readonly Action< List< TResult >, OVRTask< TResult[]> >
Signature
readonly Action<List<TResult>, OVRTask<TResult[]> > OVRTask< TResult >._onCombinedTaskCompleted

Properties

HasResult : bool
[Get]
Whether there is a result available.
This property is true when the OVRTask<TResult> is complete (IsCompleted is true) and GetResult has not already been called.
Note that GetResult is called implicitly when using await or ContinueWith.
Signature
bool OVRTask< TResult >.HasResult
IsCompleted : bool
[Get]
Indicates whether the task has completed.
Choose only one pattern out of the three proposed way of awaiting for the task completion: Polling,async/await or ContinueWith(Action<TResult>) as all three patterns will end up calling the GetResult which can only be called once.
Signature
bool OVRTask< TResult >.IsCompleted
IsFaulted : bool
[Get]
Whether the task completed due to an unhandled exception.
If the task is in a faulted state, then you can extract the exception with GetException.
Signature
bool OVRTask< TResult >.IsFaulted

Methods

ContinueWith ( onCompleted )
Registers a delegate to be invoked on completion of the task.
The delegate will be invoked with the TResult result as parameter.
Do not use in conjunction with any other methods (await or calling GetResult).
Note: If the task throws an exception during execution, there is no way to catch it in when using ContinueWith. Most Meta XR Core SDK calls that return an OVRTask do not throw, but it is possible to return an OVRTask<TResult> from your own async method, which can still throw. For example,
async OVRTask<OVRAnchor> DoSomethingAsync() {
  var anchor = await OVRAnchor.CreateSpatialAnchorAsync(pose); // <– doesn't throw
  throw new Exception(); // <– Cannot be caught if using ContinueWith
  return anchor;
}

async void MethodA() {
  try {
    var anchor = await DoSomethingAsync();
  } catch (Exception e) {
    // okay; exception caught!
  }
}

void MethodB() {
  DoSomethingAsync().ContinueWith(anchor => {
    Debug.Log($"Anchor {anchor} created!");
  });
In the above example, the exception generated by DoSomethingAsync is caught in MethodA, but there is no way to catch it in MethodB because it uses ContinueWith rather than await. The exception is still thrown, however.
Signature
void OVRTask< TResult >.ContinueWith(Action< TResult > onCompleted)
Parameters
onCompleted: Action< TResult >  A delegate to be invoked when this task completes. If the task is already complete, onCompleted is invoked immediately.
Returns
void
Throws
ArgumentNullException  Thrown if onCompleted is null. InvalidOperationException  Thrown if this task is already being awaited. InvalidOperationException  Thrown if this task is already used in another ContinueWith. InvalidOperationException  Thrown if this task is already used as a ValueTask (ToValueTask). InvalidOperationException  Thrown if this task is already used or as an Awaitable. (ToAwaitable, only available in Unity 2023.1+).
ContinueWith< T > ( onCompleted , state )
Registers a delegate that will get called on completion of the task.
The delegate will be invoked with state and the TResult result as parameters. Do not use in conjunction with any other methods (await or calling GetResult).
Note: If the task throws an exception during execution, there is no way to catch it in when using a callback. See ContinueWith(Action<TResult>) for more details.
Signature
void OVRTask< TResult >.ContinueWith< T >(Action< TResult, T > onCompleted, T state)
Parameters
onCompleted: Action< TResult, T >  A delegate to be invoked when this task completes. If the task is already complete, onCompleted is invoked immediately.
state: T  An object to store and pass to onCompleted .
Returns
void
Throws
ArgumentNullException  Thrown if onCompleted is null. InvalidOperationException  Thrown if this task is already being awaited. InvalidOperationException  Thrown if this task is already used in another ContinueWith. InvalidOperationException  Thrown if this task is already used as a ValueTask (ToValueTask). InvalidOperationException  Thrown if this task is already used or as an Awaitable. (ToAwaitable, only available in Unity 2023.1+).
Dispose ()
Disposes of the task.
Invalidate this object but does not cancel the task. In the case where the result will not actually be consumed, it must be called to prevent a memory leak. You can not call GetResult nor use await on a disposed task.
Signature
void OVRTask< TResult >.Dispose()
Returns
void
Equals ( other )
Signature
bool OVRTask< TResult >.Equals(OVRTask< TResult > other)
Parameters
other: OVRTask< TResult >
Returns
bool
Equals ( obj )
Signature
override bool OVRTask< TResult >.Equals(object obj)
Parameters
obj: object
Returns
override bool
GetAwaiter ()
Gets an awaiter that satisfies the await contract.
This allows an OVRTask<T> to be awaited using the await keyword. Typically, you should not call this directly; instead, it is invoked by the compiler, e.g.,
// Something that returns an OVRTask<T>
var task = GetResultAsync();

// compiler uses GetAwaiter here
var result = await task;
Or, more commonly:
var result = await GetResultAsync();
Requires the main thread to complete the await contract - blocking can result in an infinite loop.
Signature
Awaiter OVRTask< TResult >.GetAwaiter()
Returns
Awaiter  Returns an Awaiter-like object that satisfies the await pattern.
GetException ()
Get the exception if the task is in a faulted state.
If IsFaulted is True, then this method gets the exception associated with this method. Similar to GetResult, you can only get the exception once and throws if there is no exception.
When using await or ContinueWith, you do not need to explicitly get the exception. Use this method when you have an exception when it is implicitly created by the compiler and you query the task object directly, as in the following example:
async OVRTask<bool> DoSomethingAsync() {
  var anchor = await OVRAnchor.CreateSpatialAnchorAsync(pose); // <– implicitly generated OVRTask<bool>
  SomeMethodThatThrows();
  return true;
}

OVRTask<bool> task = DoSomethingAsync();

// later...

if (task.IsFaulted) {
  throw task.GetException();
}
Signature
Exception OVRTask< TResult >.GetException()
Returns
Exception  Returns the Exception associated with the task.
Throws
InvalidOperationException  Thrown if IsFaulted is False.
GetHashCode ()
Signature
override int OVRTask< TResult >.GetHashCode()
Returns
override int
GetResult ()
Gets the result of the asynchronous operation.
This method should only be called once IsCompleted is true. Calling it multiple times will throw InvalidOperationException.
Note that GetResult is called implicitly when using await or ContinueWith. You should not call this method explicitly when using one of those mechanisms.
Signature
TResult OVRTask< TResult >.GetResult()
Returns
TResult  Returns the result of type TResult .
Throws
InvalidOperationException  Thrown when the task doesn't have any available result. This could happen if the method is called before IsCompleted is true, after the task has been disposed of, if this method has already been called once, or if an exception was thrown during the task's execution.
ToString ()
Signature
override string OVRTask< TResult >.ToString()
Returns
override string
ToValueTask ()
Converts the task to a ValueTask.
This method converts this OVRTask<TResult> to a ValueTask.
A ValueTask is similar to an OVRTask. Key differences:
  • A ValueTask does not support ContinueWith
  • A ValueTask does not support WhenAll(System.Collections.Generic.IEnumerable<OVRTask<TResult>>)
The above are only supported on the Task object.
Invoking this method also invalidates this OVRTask<TResult>. It is invalid to continue using an OVRTask<TResult> after calling ToValueTask.
Signature
ValueTask< TResult > OVRTask< TResult >.ToValueTask()
Returns
ValueTask< TResult >  Returns a new ValueTask that completes when the asynchronous operation completes.
Throws
InvalidOperationException  Thrown if the task is not pending (IsCompleted is true) and does not have a result (HasResult is false) InvalidOperationException  Thrown if the task has already been awaited. InvalidOperationException  Thrown if ContinueWith has already been called.
TryGetResult ( result )
Tries to get the result of the asynchronous operation.
This method may safely be called at any time. It tests whether the operation is both complete (IsCompleted is True) and the result has not already been retrieved with GetResult (HasResult is True).
If the result is available, result is set to the result and this method returns True. This method is equivalent to (though more efficient than) the following:
if (task.HasResult) {
  result = task.GetResult();
  return true;
} else {
  result = default;
  return false;
}
Signature
bool OVRTask< TResult >.TryGetResult(out TResult result)
Parameters
result: out TResult  Set to the result of the task, if one is available. Otherwise, it is set to the default value for TResult .
Returns
bool True if this task is complete and a result is available.
Throws
InvalidOperationException  Thrown when the task doesn't have any available result. This could happen if the method is called before IsCompleted is true, after the task has been disposed of or if this method has already been called once.
TryInvokeContinuation ()
Signature
bool OVRTask< TResult >.TryInvokeContinuation()
Returns
bool
TryRemoveInternalData ()
Removes internal data related to the task.
Removes incremental result subscribers and internal data. Call this when the task completes.
Signature
bool OVRTask< TResult >.TryRemoveInternalData()
Returns
bool True if the task was pending, otherwise False
ValidateDelegateAndThrow ( delegate , paramName )
Signature
void OVRTask< TResult >.ValidateDelegateAndThrow(object @delegate, string paramName)
Parameters
delegate: object @
paramName: string
Returns
void

Static Methods

Create< TResult > ( taskId )
Creates a new task.
This method creates a new pending task. When the task completes, set its result with SetResult<TResult>.
The returned task is in a pending state; that is, OVRTask<TResult>.IsCompleted is False until you later set its result with SetResult<TResult>.
The taskId must be unique to the new task. You may use any Guid as long as it has not previously been used to create a task. Use
Guid.NewGuid()
to generate a random task id.
Signature
static OVRTask< TResult > OVRTask< TResult >.Create< TResult >(Guid taskId)
Parameters
taskId: Guid  The id used to assign the new task.
Returns
OVRTask< TResult >  Returns a new task which completes when you call SetResult<TResult>.
Throws
ArgumentException  Thrown if taskId refers to an existing task.
FromResult< TResult > ( result )
Creates an already-complete task.
This creates a completed task whose result is result .
Signature
static OVRTask< TResult > OVRTask< TResult >.FromResult< TResult >(TResult result)
Parameters
result: TResult  The result of the task.
Returns
OVRTask< TResult >  Returns a new, completed task-like object whose result is result .
operator!= ( lhs , rhs )
Signature
static bool OVRTask< TResult >.operator!=(OVRTask< TResult > lhs, OVRTask< TResult > rhs)
Parameters
lhs: OVRTask< TResult >
rhs: OVRTask< TResult >
Returns
bool
operator== ( lhs , rhs )
Signature
static bool OVRTask< TResult >.operator==(OVRTask< TResult > lhs, OVRTask< TResult > rhs)
Parameters
lhs: OVRTask< TResult >
rhs: OVRTask< TResult >
Returns
bool
SetResult< TResult > ( id , result )
Sets the result of a pending task.
Set the result of a task previously created with Create<TResult>. When this method returns, OVRTask<TResult>.IsCompleted will be true.
OVRTask<int> MyOpAsync() {
  _id = Guid.NewGuid();
  var task = OVRTask.Create<int>(id);
  return task;
}

// later, when the task completes:
void Update() {
  if (operationComplete) {
    OVRTask.SetResult(_id, result);
  }
}
This allows you to await on MyOpAsync:
async void OnButtonPressed() {
  var result = await MyOpAsync();
}
Signature
static void OVRTask< TResult >.SetResult< TResult >(Guid id, TResult result)
Parameters
id: Guid  The task's unique id.
result: TResult  The result the task should have.
Returns
void
Throws
InvalidOperationException  Thrown if the task with id id already has a result.
WhenAll< T1, T2 > ( task1 , task2 )
Creates a new task that will complete when all of the given tasks have completed.
This method can be used to combine multiple tasks into a single task that depends on all of them. When the returned task completes, the results of all combined tasks can be accessed through the result of the returned task. The type of the result is a tuple containing the result types of each input task, that is
ValueTuple<T1, T2>
For example,
var (result1, result2) = await OVRTask.Combine(task1, task2);
Signature
static OVRTask<(T1, T2)> OVRTask< TResult >.WhenAll< T1, T2 >(OVRTask< T1 > task1, OVRTask< T2 > task2)
Parameters
task1: OVRTask< T1 >  The first task to combine
task2: OVRTask< T2 >  The second task to combine
Returns
OVRTask<(T1, T2)>  A task that represents the completion of all input tasks.
WhenAll< T1, T2, T3 > ( task1 , task2 , task3 )
Creates a new task that will complete when all of the given tasks have completed.
This method can be used to combine multiple tasks into a single task that depends on all of them. When the returned task completes, the results of all combined tasks can be accessed through the result of the returned task. The type of the result is a tuple containing the result types of each input task, that is
ValueTuple<T1, T2, T3>
For example,
var (result1, result2, result3) = await OVRTask.Combine(task1, task2, task3);
Signature
static OVRTask<(T1, T2, T3)> OVRTask< TResult >.WhenAll< T1, T2, T3 >(OVRTask< T1 > task1, OVRTask< T2 > task2, OVRTask< T3 > task3)
Parameters
task1: OVRTask< T1 >  The first task to combine
task2: OVRTask< T2 >  The second task to combine
task3: OVRTask< T3 >  The third task to combine
Returns
OVRTask<(T1, T2, T3)>  A task that represents the completion of all input tasks.
WhenAll< T1, T2, T3, T4 > ( task1 , task2 , task3 , task4 )
Creates a new task that will complete when all of the given tasks have completed.
This method can be used to combine multiple tasks into a single task that depends on all of them. When the returned task completes, the results of all combined tasks can be accessed through the result of the returned task. The type of the result is a tuple containing the result types of each input task, that is
ValueTuple<T1, T2, T3, T4>
For example,
var (result1, result2, result3, result4) = await OVRTask.Combine(task1, task2, task3, task4);
Signature
static OVRTask<(T1, T2, T3, T4)> OVRTask< TResult >.WhenAll< T1, T2, T3, T4 >(OVRTask< T1 > task1, OVRTask< T2 > task2, OVRTask< T3 > task3, OVRTask< T4 > task4)
Parameters
task1: OVRTask< T1 >  The first task to combine
task2: OVRTask< T2 >  The second task to combine
task3: OVRTask< T3 >  The third task to combine
task4: OVRTask< T4 >  The forth task to combine
Returns
OVRTask<(T1, T2, T3, T4)>  A task that represents the completion of all input tasks.
WhenAll< T1, T2, T3, T4, T5 > ( task1 , task2 , task3 , task4 , task5 )
Creates a new task that will complete when all of the given tasks have completed.
This method can be used to combine multiple tasks into a single task that depends on all of them. When the returned task completes, the results of all combined tasks can be accessed through the result of the returned task. The type of the result is a tuple containing the result types of each input task, that is
ValueTuple<T1, T2, T3, T4, T5>
For example,
var (result1, result2, result3, result4, result5) = await OVRTask.Combine(task1, task2, task3, task4, task5);
Signature
static OVRTask<(T1, T2, T3, T4, T5)> OVRTask< TResult >.WhenAll< T1, T2, T3, T4, T5 >(OVRTask< T1 > task1, OVRTask< T2 > task2, OVRTask< T3 > task3, OVRTask< T4 > task4, OVRTask< T5 > task5)
Parameters
task1: OVRTask< T1 >  The first task to combine
task2: OVRTask< T2 >  The second task to combine
task3: OVRTask< T3 >  The third task to combine
task4: OVRTask< T4 >  The forth task to combine
task5: OVRTask< T5 >  The fifth task to combine
Returns
OVRTask<(T1, T2, T3, T4, T5)>  A task that represents the completion of all input tasks.
WhenAll< T1, T2, T3, T4, T5, T6 > ( task1 , task2 , task3 , task4 , task5 , task6 )
Creates a new task that will complete when all of the given tasks have completed.
This method can be used to combine multiple tasks into a single task that depends on all of them. When the returned task completes, the results of all combined tasks can be accessed through the result of the returned task. The type of the result is a tuple containing the result types of each input task, that is
ValueTuple<T1, T2, T3, T4, T5, T6>
For example,
var (result1, result2, result3, result4, result5, result6) = await OVRTask.Combine(task1, task2, task3, task4, task5, task6);
Signature
static OVRTask<(T1, T2, T3, T4, T5, T6)> OVRTask< TResult >.WhenAll< T1, T2, T3, T4, T5, T6 >(OVRTask< T1 > task1, OVRTask< T2 > task2, OVRTask< T3 > task3, OVRTask< T4 > task4, OVRTask< T5 > task5, OVRTask< T6 > task6)
Parameters
task1: OVRTask< T1 >  The first task to combine
task2: OVRTask< T2 >  The second task to combine
task3: OVRTask< T3 >  The third task to combine
task4: OVRTask< T4 >  The forth task to combine
task5: OVRTask< T5 >  The fifth task to combine
task6: OVRTask< T6 >  The sixth task to combine
Returns
OVRTask<(T1, T2, T3, T4, T5, T6)>  A task that represents the completion of all input tasks.
WhenAll< T1, T2, T3, T4, T5, T6, T7 > ( task1 , task2 , task3 , task4 , task5 , task6 , task7 )
Creates a new task that will complete when all of the given tasks have completed.
This method can be used to combine multiple tasks into a single task that depends on all of them. When the returned task completes, the results of all combined tasks can be accessed through the result of the returned task. The type of the result is a tuple containing the result types of each input task, that is
ValueTuple<T1, T2, T3, T4, T5, T6, T7>
For example,
var (result1, result2, result3, result4, result5, result6, result7) = await OVRTask.Combine(task1, task2, task3, task4, task5, task6, task7);
Signature
static OVRTask<(T1, T2, T3, T4, T5, T6, T7)> OVRTask< TResult >.WhenAll< T1, T2, T3, T4, T5, T6, T7 >(OVRTask< T1 > task1, OVRTask< T2 > task2, OVRTask< T3 > task3, OVRTask< T4 > task4, OVRTask< T5 > task5, OVRTask< T6 > task6, OVRTask< T7 > task7)
Parameters
task1: OVRTask< T1 >  The first task to combine
task2: OVRTask< T2 >  The second task to combine
task3: OVRTask< T3 >  The third task to combine
task4: OVRTask< T4 >  The forth task to combine
task5: OVRTask< T5 >  The fifth task to combine
task6: OVRTask< T6 >  The sixth task to combine
task7: OVRTask< T7 >  The seventh task to combine
Returns
OVRTask<(T1, T2, T3, T4, T5, T6, T7)>  A task that represents the completion of all input tasks.
WhenAll< T1, T2, T3, T4, T5, T6, T7, T8 > ( task1 , task2 , task3 , task4 , task5 , task6 , task7 , task8 )
Creates a new task that will complete when all of the given tasks have completed.
This method can be used to combine multiple tasks into a single task that depends on all of them. When the returned task completes, the results of all combined tasks can be accessed through the result of the returned task. The type of the result is a tuple containing the result types of each input task, that is
ValueTuple<T1, T2, T3, T4, T5, T6, T7, T8>
For example,
var (result1, result2, result3, result4, result5, result6, result7, result8) = await OVRTask.Combine(task1, task2, task3, task4, task5, task6, task7, task8);
Signature
static OVRTask<(T1, T2, T3, T4, T5, T6, T7, T8)> OVRTask< TResult >.WhenAll< T1, T2, T3, T4, T5, T6, T7, T8 >(OVRTask< T1 > task1, OVRTask< T2 > task2, OVRTask< T3 > task3, OVRTask< T4 > task4, OVRTask< T5 > task5, OVRTask< T6 > task6, OVRTask< T7 > task7, OVRTask< T8 > task8)
Parameters
task1: OVRTask< T1 >  The first task to combine
task2: OVRTask< T2 >  The second task to combine
task3: OVRTask< T3 >  The third task to combine
task4: OVRTask< T4 >  The forth task to combine
task5: OVRTask< T5 >  The fifth task to combine
task6: OVRTask< T6 >  The sixth task to combine
task7: OVRTask< T7 >  The seventh task to combine
task8: OVRTask< T8 >  The eighth task to combine
Returns
OVRTask<(T1, T2, T3, T4, T5, T6, T7, T8)>  A task that represents the completion of all input tasks.
WhenAll< TResult > ( tasks )
Creates a task that completes when all of the supplied tasks have completed.
This can be used to combine multiple tasks into a single task. The returned task completes when all tasks in tasks complete.
The result of the returned task is an array containing the results of each individual task. The results are arranged in the same order as the original tasks list.
Signature
static OVRTask< TResult[]> OVRTask< TResult >.WhenAll< TResult >(IEnumerable< OVRTask< TResult > > tasks)
Parameters
tasks: IEnumerable< OVRTask< TResult > >  The tasks to combine
Returns
OVRTask< TResult[]>  A new task which is completed when all tasks have completed.
Throws
ArgumentNullException  Thrown if tasks is null.
WhenAll< TResult > ( tasks , results )
Creates a task that completes when all of the supplied tasks have completed.
This can be used to combine multiple tasks into a single task. The returned task completes when all tasks in tasks complete.
The result of each task in tasks is added to results . The results are in the same order as tasks .
The list in the combined task is a reference to results . This allows the caller to own (and potentially reuse) the memory for the list of results. It is undefined behavior to access results before the returned task completes.
Signature
static OVRTask< List< TResult > > OVRTask< TResult >.WhenAll< TResult >(IEnumerable< OVRTask< TResult > > tasks, List< TResult > results)
Parameters
tasks: IEnumerable< OVRTask< TResult > >  The tasks to combine
results: List< TResult >  A list to store the results in. The list is cleared before adding any results to it.
Returns
OVRTask< List< TResult > >  A new task which completes when all tasks are complete.
Throws
ArgumentNullException  Thrown if tasks is null. ArgumentNullException  Thrown if results is null.

Inner Classes

Awaitable Class

AwaitableCompletionSource Class

Properties

Awaitable : Awaitable< T >
[Get]
Signature
Awaitable<T> OVRTask< TResult >.AwaitableCompletionSource< T >.Awaitable

Methods

Reset ()
Signature
void OVRTask< TResult >.AwaitableCompletionSource< T >.Reset()
Returns
void
SetException ( exception )
Signature
void OVRTask< TResult >.AwaitableCompletionSource< T >.SetException(Exception exception)
Parameters
exception: Exception
Returns
void
SetResult ( result )
Signature
void OVRTask< TResult >.AwaitableCompletionSource< T >.SetResult(in T result)
Parameters
result: in T
Returns
void

AwaitableSource Class

Extends OVRTask< TResult >.AwaitableCompletionSource< TResult >

Methods

OnGet ()
Signature
void OVRTask< TResult >.AwaitableSource.OnGet()
Returns
void
OnReturn ()
Signature
void OVRTask< TResult >.AwaitableSource.OnReturn()
Returns
void
SetResultAndReturnToPool ( result )
Signature
void OVRTask< TResult >.AwaitableSource.SetResultAndReturnToPool(in TResult result)
Parameters
result: in TResult
Returns
void

IncrementalResultSubscriber Class

A delegate to invoke when incremental data is received.
It is up to the task creator to provide incremental data, but this offers a way to store the delegates, if your API offers one to the caller of an async operation.

Static Methods

Notify ( taskId , result )
Signature
static void OVRTask< TResult >.IncrementalResultSubscriber< T >.Notify(Guid taskId, T result)
Parameters
taskId: Guid
result: T
Returns
void
Set ( taskId , subscriber )
Signature
static void OVRTask< TResult >.IncrementalResultSubscriber< T >.Set(Guid taskId, Action< T > subscriber)
Parameters
taskId: Guid
subscriber: Action< T >
Returns
void

InternalData Class

Represents additional data associated with the task.
These "removers" and "clearers" offer a sort of type erasure so that we can store a typeless delegate to invoke that doesn't depend on T .

Static Methods

Set ( taskId , data )
Signature
static void OVRTask< TResult >.InternalData< T >.Set(Guid taskId, T data)
Parameters
taskId: Guid
data: T
Returns
void
TryGet ( taskId , data )
Signature
static bool OVRTask< TResult >.InternalData< T >.TryGet(Guid taskId, out T data)
Parameters
taskId: Guid
data: out T
Returns
bool

TaskSource Class

Extends IValueTaskSource< TResult >

Properties

Task : ValueTask< TResult >
[Get]
Signature
ValueTask<TResult> OVRTask< TResult >.TaskSource.Task

Methods

GetResult ( token )
Signature
TResult OVRTask< TResult >.TaskSource.GetResult(short token)
Parameters
token: short
Returns
TResult
GetStatus ( token )
Signature
ValueTaskSourceStatus OVRTask< TResult >.TaskSource.GetStatus(short token)
Parameters
token: short
Returns
ValueTaskSourceStatus
OnCompleted ( continuation , state , token , flags )
Signature
void OVRTask< TResult >.TaskSource.OnCompleted(Action< object > continuation, object state, short token, ValueTaskSourceOnCompletedFlags flags)
Parameters
continuation: Action< object >
state: object
token: short
flags: ValueTaskSourceOnCompletedFlags
Returns
void
SetException ( exception )
Signature
void OVRTask< TResult >.TaskSource.SetException(Exception exception)
Parameters
exception: Exception
Returns
void
SetResult ( result )
Signature
void OVRTask< TResult >.TaskSource.SetResult(TResult result)
Parameters
result: TResult
Returns
void

Inner Structs

Awaiter Struct

Extends INotifyCompletion
Definition of an awaiter that satisfies the await contract.
This allows an OVRTask<T> to be awaited using the await keyword. Typically, you should not use this struct; instead, it is used by the compiler by automatically calling the GetAwaiter method when using the await keyword.

Properties

IsCompleted : bool
[Get]
Whether the task has completed.
When True the asynchronous operation associated with the OVRTask<TResult> that created this Awaiter (see OVRTask<TResult>.GetAwaiter) is complete.
Typically, you would not call this directly. This is queried by a compiler-generated state machine to support async / await.
Signature
bool OVRTask< TResult >.Awaiter.IsCompleted

Methods

GetResult ()
Gets the result of the asynchronous operation.
Typically, you should not call this directly. Use OVRTask<TResult>.GetResult() instead.
Signature
TResult OVRTask< TResult >.Awaiter.GetResult()
Returns
TResult  The result of the asynchronous operation.
Throws
InvalidOperationException  Thrown if there is no result available.
OnCompleted ( continuation )
Provides the Awaiter with a method to call when the task completes.
Do not call this directly. It is called by a compiler-generated state machine when using the await keyword.
Signature
void INotifyCompletion. OVRTask< TResult >.Awaiter.OnCompleted(Action continuation)
Parameters
continuation: Action  The continuation to invoke when the task is complete.
Returns
void INotifyCompletion.

Callback Struct

Constructors

Callback ( delegate )
Signature
OVRTask< TResult >.Callback.Callback(Action< TResult > @delegate)
Parameters
delegate: Action< TResult > @

Fields

_delegate : readonly Action< TResult >
Signature
readonly Action<TResult> OVRTask< TResult >.Callback._delegate

Static Fields

Clearer : readonly Action
Signature
readonly Action OVRTask< TResult >.Callback.Clearer
Invoker : readonly ContinueWithInvoker
Signature
readonly ContinueWithInvoker OVRTask< TResult >.Callback.Invoker
Remover : readonly ContinueWithRemover
Signature
readonly ContinueWithRemover OVRTask< TResult >.Callback.Remover

Methods

Invoke ( result )
Signature
void OVRTask< TResult >.Callback.Invoke(TResult result)
Parameters
result: TResult
Returns
void

Static Methods

Add ( taskId , delegate )
Signature
static void OVRTask< TResult >.Callback.Add(Guid taskId, Action< TResult > @delegate)
Parameters
taskId: Guid
delegate: Action< TResult > @
Returns
void
Clear ()
Signature
static void OVRTask< TResult >.Callback.Clear()
Returns
void
Invoke ( taskId , result )
Signature
static void OVRTask< TResult >.Callback.Invoke(Guid taskId, TResult result)
Parameters
taskId: Guid
result: TResult
Returns
void
Remove ( taskId )
Signature
static bool OVRTask< TResult >.Callback.Remove(Guid taskId)
Parameters
taskId: Guid
Returns
bool

CallbackWithState Struct

Constructors

CallbackWithState ( data , delegate )
Signature
OVRTask< TResult >.CallbackWithState< T >.CallbackWithState(T data, Action< TResult, T > @delegate)
Parameters
data: T
delegate: Action< TResult, T > @

Fields

_data : readonly T
Signature
readonly T OVRTask< TResult >.CallbackWithState< T >._data
_delegate : readonly Action< TResult, T >
Signature
readonly Action<TResult, T> OVRTask< TResult >.CallbackWithState< T >._delegate

Static Methods

Add ( taskId , data , callback )
Signature
static void OVRTask< TResult >.CallbackWithState< T >.Add(Guid taskId, T data, Action< TResult, T > callback)
Parameters
taskId: Guid
data: T
callback: Action< TResult, T >
Returns
void
Invoke ( taskId , result )
Signature
static void OVRTask< TResult >.CallbackWithState< T >.Invoke(Guid taskId, TResult result)
Parameters
taskId: Guid
result: TResult
Returns
void

CombinedTaskData Struct

Extends System.IDisposable

Constructors

CombinedTaskData ( tasks , userOwnedResultList )
Signature
OVRTask< TResult >.CombinedTaskData.CombinedTaskData(IEnumerable< OVRTask< TResult > > tasks, List< TResult > userOwnedResultList)
Parameters
tasks: IEnumerable< OVRTask< TResult > >
userOwnedResultList: List< TResult >

Fields

_completedTasks : readonly Dictionary< Guid, TResult >
Signature
readonly Dictionary<Guid, TResult> OVRTask< TResult >.CombinedTaskData._completedTasks
_originalTaskOrder : readonly List< Guid >
Signature
readonly List<Guid> OVRTask< TResult >.CombinedTaskData._originalTaskOrder
_remainingTaskIds : readonly HashSet< Guid >
Signature
readonly HashSet<Guid> OVRTask< TResult >.CombinedTaskData._remainingTaskIds
_userOwnedResultList : readonly List< TResult >
Signature
readonly List<TResult> OVRTask< TResult >.CombinedTaskData._userOwnedResultList
Task : readonly OVRTask< List< TResult > >
Signature
readonly OVRTask<List<TResult> > OVRTask< TResult >.CombinedTaskData.Task

Static Fields

_onSingleTaskCompleted : readonly Action< TResult, CombinedTaskDataWithCompletedTaskId >
Signature
readonly Action<TResult, CombinedTaskDataWithCompletedTaskId> OVRTask< TResult >.CombinedTaskData._onSingleTaskCompleted

Methods

Dispose ()
Signature
void OVRTask< TResult >.CombinedTaskData.Dispose()
Returns
void
OnSingleTaskCompleted ( taskId , result )
Signature
void OVRTask< TResult >.CombinedTaskData.OnSingleTaskCompleted(Guid taskId, TResult result)
Parameters
taskId: Guid
result: TResult
Returns
void

CombinedTaskDataWithCompletedTaskId Struct

Fields

CombinedData : CombinedTaskData
Signature
CombinedTaskData OVRTask< TResult >.CombinedTaskDataWithCompletedTaskId.CombinedData
CompletedTaskId : Guid
Signature
Guid OVRTask< TResult >.CombinedTaskDataWithCompletedTaskId.CompletedTaskId