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

OVRMarkerPayload Struct

Extends IOVRAnchorComponent< OVRMarkerPayload >, IEquatable< OVRMarkerPayload >
Represents a marker payload (QR Code) associated with an OVRAnchor.
Anchors with a payload support this component type. In order to access an anchor's payload, first get this component from the OVRAnchor, as in the following example:
void AccessPayload(OVRAnchor anchor) {
if (!anchor.TryGetComponent\<OVRMarkerPayload\>(out var payload)) {
    Debug.LogError("Anchor does not have a payload component.");
return;
  }
  Debug.Log($"Anchor payload is of type {payload.PayloadType}.");
}
A OVRMarkerPayload can represent different types of data, indicated by the PayloadType property. If the type is a OVRMarkerPayloadType.StringQRCode, use AsString to get the payload as a System.String.
You can access the raw bytes with the GetBytes method or Bytes property.

Public Statics

A null representation of an OVRMarkerPayload.
Use this to compare with another component to determine whether it is null.

Properties

Whether this object represents a valid anchor component.
True if this component is enabled and no change to its enabled status is pending.
SpaceComponentType Type[Get]
ulong Handle[Get]
OVRMarkerPayloadType PayloadType[Get]
A copy of the payload bytes.
This property creates a new copy of the payload bytes each time it is invoked. Use GetBytes to provide your own buffer.
The number of bytes in the payload.

Member Functions

Compares this component for equality with other .
Parameters
other
The other component to compare with.
Returns
True if both components belong to the same OVRAnchor, otherwise false.
Compares this component for equality with obj .
Parameters
obj
The object to compare with.
Returns
True if obj is an OVRMarkerPayload and Equals(OVRMarkerPayload) is true, otherwise false.
Gets a hashcode suitable for use in a Dictionary or HashSet.
Returns
A hashcode for this component.
Gets a string representation of this component.
Returns
A string representation of this component.
Gets the payload as a string.
PayloadType must be OVRMarkerPayloadType.StringQRCode.
Returns
Returns the payload as a string.
Exceptions
InvalidOperationException
Thrown if PayloadType is not OVRMarkerPayloadType.StringQRCode
Copies the payload bytes to buffer .
Use this method to copy the payload data into a byte array. buffer must be large enough to hold the data. Use ByteCount to create a buffer large enough to hold the payload data.
byte[] GetData(OVRMakerPayload payload)
{
    var bytes = newbyte[payload.ByteCount];
    var length = payload.GetBytes(bytes);
return bytes;
}
Parameters
buffer
A Span to write the payload data to.
Returns
Returns the number of bytes written to buffer .
Exceptions
ArgumentException
Thrown if buffer is less than ByteCount.

Static Member Functions

Compares two components for equality.
Parameters
lhs
The component to compare with rhs .
rhs
The component to compare with lhs .
Returns
True if both components belong to the same OVRAnchor, otherwise false.
Compares two components for inequality.
Parameters
lhs
The component to compare with rhs .
rhs
The component to compare with lhs .
Returns
True if the components do not belong to the same OVRAnchor, otherwise false.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon