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

OVRMarkerPayload Struct

Extends IEquatable< OVRMarkerPayload >
(Obsolete) 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.

Static Fields

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

Properties

ByteCount : int
[Get]
The number of bytes in the payload.
Signature
int ByteCount
Bytes : ArraySegment< byte >
[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.
Signature
ArraySegment<byte> Bytes
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
PayloadType : OVRMarkerPayloadType
[Get]
The payload type, e.g., string vs binary.
Signature
OVRMarkerPayloadType PayloadType

Methods

AsString ()
Gets the payload as a string.
PayloadType must be OVRMarkerPayloadType.StringQRCode.
Signature
string AsString()
Returns
string  Returns the payload as a string.
Throws
InvalidOperationException  Thrown if PayloadType is not OVRMarkerPayloadType.StringQRCode
Equals ( other )
Compares this component for equality with other .
Signature
bool Equals(OVRMarkerPayload other)
Parameters
other: OVRMarkerPayload  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 OVRMarkerPayload and Equals(OVRMarkerPayload) is true, otherwise false.
GetBytes ( buffer )
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 = new byte[payload.ByteCount];
    var length = payload.GetBytes(bytes);
    return bytes;
}
Signature
int GetBytes(Span< byte > buffer)
Parameters
buffer: Span< byte >  A Span to write the payload data to.
Returns
int  Returns the number of bytes written to buffer .
Throws
ArgumentException  Thrown if buffer is less than ByteCount.
GetHashCode ()
Gets a hashcode suitable for use in a Dictionary or HashSet.
Signature
override int GetHashCode()
Returns
override int  A hashcode for this component.
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!=(OVRMarkerPayload lhs, OVRMarkerPayload rhs)
Parameters
lhs: OVRMarkerPayload  The component to compare with rhs .
rhs: OVRMarkerPayload  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==(OVRMarkerPayload lhs, OVRMarkerPayload rhs)
Parameters
lhs: OVRMarkerPayload  The component to compare with rhs .
rhs: OVRMarkerPayload  The component to compare with lhs .
Returns
bool  True if both components belong to the same OVRAnchor, otherwise false.