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}.");
}System.String.
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 |
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 |
AsString
()
|
Gets the payload as a string.
PayloadType must be OVRMarkerPayloadType.StringQRCode.
Signature
string AsString() Returns string
Returns the payload as a string.
|
Equals
(
other
)
|
Compares this component for equality with other .
Signature
bool Equals(OVRMarkerPayload other) Parameters |
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 .
|
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.
|
operator!=
(
lhs
, rhs
)
|
Compares two components for inequality.
Signature
static bool operator!=(OVRMarkerPayload lhs, OVRMarkerPayload rhs) Parameters |
operator==
(
lhs
, rhs
)
|
Compares two components for equality.
Signature
static bool operator==(OVRMarkerPayload lhs, OVRMarkerPayload rhs) Parameters |