Class XRReferenceImageLibraryExtensions
Extension methods for the XRReference
Inherited Members
Namespace: UnityEditor .XR.ARSubsystems
Assembly: Unity.XR.ARSubsystems.Editor.dll
Syntax
public static class XRReferenceImageLibraryExtensions
Remarks
At runtime, XRReference
Methods
Add(XRReferenceImageLibrary)
Creates an empty XRReferenceImage
and adds it to the library. The new
reference image is inserted at the end of the list of reference images.
Declaration
public static void Add(this XRReferenceImageLibrary library)
Parameters
Type | Name | Description |
---|---|---|
XRReference |
library | The XRReference |
Exceptions
Type | Condition |
---|---|
Argument |
Thrown if |
ClearDataStore(XRReferenceImageLibrary)
Clears the binary data store.
Declaration
public static void ClearDataStore(this XRReferenceImageLibrary library)
Parameters
Type | Name | Description |
---|---|---|
XRReference |
library | The XRReference |
Remarks
Provider-specific binary data can be associated with each
XRReference
RemoveAt(XRReferenceImageLibrary, int)
Removes the XRReferenceindex
.
Declaration
public static void RemoveAt(this XRReferenceImageLibrary library, int index)
Parameters
Type | Name | Description |
---|---|---|
XRReference |
library | The XRReference |
int | index | The index in the list of images to remove. |
Exceptions
Type | Condition |
---|---|
Argument |
Thrown if |
Index |
Thrown if |
SetDataForKey(XRReferenceImageLibrary, string, byte[])
Associate binary data with a string key.
Declaration
public static void SetDataForKey(this XRReferenceImageLibrary library, string key, byte[] data)
Parameters
Type | Name | Description |
---|---|---|
XRReference |
library | The XRReference |
string | key | The key which can be used to later retrieve |
byte[] | data | The data to associate with |
Remarks
Providers use this to associate provider-specific data with the library. During Player Build (in an
IPreprocess
Providers can use this to store a serialized version of the image library specific to that provider.
Retrieve data with data
Exceptions
Type | Condition |
---|---|
Argument |
Thrown if |
SetName(XRReferenceImageLibrary, int, string)
Sets the XRReferenceImage.name
value on the XRReferenceImage
at index
.
This value is read-only in the Player; it can only be modified in the Editor.
Declaration
public static void SetName(this XRReferenceImageLibrary library, int index, string name)
Parameters
Type | Name | Description |
---|---|---|
XRReference |
library | The |
int | index | The index of the reference image within the library to modify. |
string | name | The name being applied to the reference image. |
Exceptions
Type | Condition |
---|---|
Argument |
Thrown if |
Index |
Thrown if |
SetSize(XRReferenceImageLibrary, int, Vector2)
Sets the XRReferenceImage.size
value on the XRReferenceImage
at index
.
This value is read-only in the Player; it can only be modified in the Editor.
Declaration
public static void SetSize(this XRReferenceImageLibrary library, int index, Vector2 size)
Parameters
Type | Name | Description |
---|---|---|
XRReference |
library | The |
int | index | The index of the reference image within the library to modify. |
Vector2 | size | The size that the reference image is being set to. |
Exceptions
Type | Condition |
---|---|
Argument |
Thrown if |
Index |
Thrown if |
SetSpecifySize(XRReferenceImageLibrary, int, bool)
Sets the XRReferenceImage.specifySize
value on the XRReferenceImage
at index
.
This value is read-only in the Player; it can only be modified in the Editor.
Declaration
public static void SetSpecifySize(this XRReferenceImageLibrary library, int index, bool specifySize)
Parameters
Type | Name | Description |
---|---|---|
XRReference |
library | The |
int | index | The index of the reference image within the library to modify. |
bool | specifySize | Whether |
Exceptions
Type | Condition |
---|---|
Argument |
Thrown if |
Index |
Thrown if |
SetTexture(XRReferenceImageLibrary, int, Texture2D, bool)
Set the texture on the reference image.
Declaration
public static void SetTexture(this XRReferenceImageLibrary library, int index, Texture2D texture, bool keepTexture)
Parameters
Type | Name | Description |
---|---|---|
XRReference |
library | The XRReference |
int | index | The reference image index to modify. |
Texture2D | texture | The texture to set. |
bool | keepTexture | Whether to store a strong reference to the texture. If |
Exceptions
Type | Condition |
---|---|
Argument |
Thrown if |
Index |
Thrown if |