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

OVRSharable Struct

Extends IEquatable< OVRSharable >
Represents the ability to share an OVRAnchor.
Sharable anchors support this component type. In order to share an anchor (OVRAnchor.ShareAsync(System.Collections.Generic.IEnumerable<OVRSpaceUser>) or OVRAnchor.ShareAsync(System.Collections.Generic.IEnumerable<OVRAnchor>,System.Collections.Generic.IEnumerable<OVRSpaceUser>)), you must first enable its sharable component.
Note: The OVRSpatialAnchor component provides a higher level abstraction for the OVRAnchor type and automatically enables the sharable component. You do not need to use this component when using an OVRSpatialAnchor.
This example obtains an anchor's sharable component and enables it:
async void EnableSharing(OVRAnchor anchor) {
  if (!anchor.TryGetComponent<OVRSharable>(out var sharableComponent)) {
    Debug.LogError("Anchor does not support sharing.");
    return;
  }

  if (await sharableComponent.SetEnabledAsync(true)) {
    Debug.Log("Anchor is now sharable.");
  } else {
    Debug.LogError("Unable to enable the sharable component.");
  }
}

Static Fields

Null : readonly OVRSharable
A null representation of an OVRSharable.
Use this to compare with another component to determine whether it is null.
Signature
readonly OVRSharable Null

Properties

IsEnabled : bool
[Get]
True if this component is enabled and no change to its enabled status is pending.
Signature
bool IsEnabled
IsNull : bool
[Get]
Whether this object represents a valid anchor component.
Signature
bool IsNull

Methods

Equals ( other )
Compares this component for equality with other .
Signature
bool Equals(OVRSharable other)
Parameters
other: OVRSharable  The other component to compare with.
Returns
bool  True if both components belong to the same OVRAnchor, otherwise false.
Equals ( obj )
Compares this component for equality with obj .
Signature
override bool Equals(object obj)
Parameters
obj: object  The object to compare with.
Returns
override bool  True if obj is an OVRSharable and Equals(OVRSharable) is true, otherwise false.
GetHashCode ()
Gets a hashcode suitable for use in a Dictionary or HashSet.
Signature
override int GetHashCode()
Returns
override int  A hashcode for this component.
SetEnabledAsync ( enabled , timeout )
Sets the enabled status of this component.
A component must be enabled in order to access its data or do enable its functionality.
This method is asynchronous. Use the returned task to track the completion of this operation. The task's value indicates whether the operation was successful.
If the current enabled state matches enabled , then the returned task completes immediately with a true result. If there is already a pending change to the enabled state, the new request is queued.
Signature
OVRTask< bool > SetEnabledAsync(bool enabled, double timeout=0)
Parameters
enabled: bool  The desired state of the component.
timeout: double  The timeout, in seconds, for the operation. Use zero to indicate an infinite timeout.
Returns
OVRTask< bool >  Returns an OVRTask<bool> whose result indicates the result of the operation.
SetEnabledSafeAsync ( enabled , timeout )
(Obsolete) Sets the enabled status of this component if it differs from the current enabled state.
This method is obsolete. Use SetEnabledAsync instead.
Signature
OVRTask< bool > SetEnabledSafeAsync(bool enabled, double timeout=0)
Parameters
enabled: bool  The desired state of the component.
timeout: double  The timeout, in seconds, for the operation. Use zero to indicate an infinite timeout.
Returns
OVRTask< bool >  Returns an OVRTask<bool> whose result indicates the result of the operation.
ToString ()
Gets a string representation of this component.
Signature
override string ToString()
Returns
override string  A string representation of this component.

Static Methods

operator!= ( lhs , rhs )
Compares two components for inequality.
Signature
static bool operator!=(OVRSharable lhs, OVRSharable rhs)
Parameters
lhs: OVRSharable  The component to compare with rhs .
rhs: OVRSharable  The component to compare with lhs .
Returns
bool  True if the components do not belong to the same OVRAnchor, otherwise false.
operator== ( lhs , rhs )
Compares two components for equality.
Signature
static bool operator==(OVRSharable lhs, OVRSharable rhs)
Parameters
lhs: OVRSharable  The component to compare with rhs .
rhs: OVRSharable  The component to compare with lhs .
Returns
bool  True if both components belong to the same OVRAnchor, otherwise false.