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

UniqueIdentifier Class

A numerical identifier guaranteed to be unique within an instance of an application.
This is used to uniquely associate instances with data they generate, most commonly PointerEvents retaining the IInteractorView.Identifier of their originating interactors as their own PointerEvent.Identifier.

Properties

ID : int
[Get]
The numerical identifier associated with this UniqueIdentifier.
This number is guaranteed to be unique at any given time within an instance of an application.
"Unique at any given time" means there is never more than one valid UniqueIdentifier with the same ID at the same time within an instance of an application. However, different UniqueIdentifiers may have the same numerical ID if they do not exist at the same time as long as Release(UniqueIdentifier) has been called on the earlier instance before Generate produces the later.
This number is often used in place of the UniqueIdentifier itself; for example, IInteractorView.Identifier and the PointerEvent.Identifiers which refer to it both leveral the numerical value of the interactor's underlying UniqueIdentifier.ID.
Signature
int Oculus.Interaction.UniqueIdentifier.ID

Static Methods

Generate ()
Creates a new UniqueIdentifier with a numerical ID which is guaranteed to be unique in the application for the lifespan of the new UniqueIdentifier (i.e., until Release(UniqueIdentifier) is called upon it).
Signature
static UniqueIdentifier Oculus.Interaction.UniqueIdentifier.Generate()
Generate ( context , instance )
Creates a new UniqueIdentifier with a numerical ID which is guaranteed to be unique in the application for the lifespan of the new UniqueIdentifier (i.e., until Release(UniqueIdentifier) is called upon it).
Associates that identifier with the provided instance for future retrieval via TryGetInstanceFromIdentifier(Context, int, out object).
Signature
static UniqueIdentifier Oculus.Interaction.UniqueIdentifier.Generate(Context context, object instance)
Parameters
context: Context  The context in which the instance will be associated with the new identifier
instance: object  The instance associated with the new identifier
GetInstanceFromIdentifierAsync ( context , identifier )
Attempts to retrieve the instance associated with the provided identifier in the provided context .
Signature
static Task<object> Oculus.Interaction.UniqueIdentifier.GetInstanceFromIdentifierAsync(Context context, int identifier)
Parameters
context: Context  The Context in which to look for an instance association
identifier: int  The ID of the UniqueIdentifier for which to find the instance
Returns
Task< object >  A task returning the associated instance, if one exists
Release ( identifier )
Invalidates a UniqueIdentifier and returns its ID to the space of allowable IDs for new UniqueIdentifiers.
Any further use of the identifier after release is unsupported and can cause undefined behavior.
Signature
static void Oculus.Interaction.UniqueIdentifier.Release(UniqueIdentifier identifier)
Parameters
identifier: UniqueIdentifier  The UniqueIdentifier to be invalidated
Returns
void
TryGetInstanceFromIdentifier ( context , identifier , instance )
Attempts to retrieve the instance associated with the provided identifier in the given context .
Signature
static bool Oculus.Interaction.UniqueIdentifier.TryGetInstanceFromIdentifier(Context context, int identifier, out object instance)
Parameters
context: Context  The Context in which to look for an instance association
identifier: int  The ID of the UniqueIdentifier for which to find the instance
instance: out object  Out parameter, the discovered associated instance, if one exists
Returns
bool  True if the instance was found, false otherwise