Class XRReferenceObjectLibrary
A container for reference objects. A reference object represents a 3D scan of a real object that can be recognized in the environment. A XRObjectTrackingSubsystem will search for objects based on the contents of a XRReferenceObjectLibrary.
Inherited Members
Namespace: UnityEngine.XR.ARSubsystems
Syntax
[CreateAssetMenu(fileName = "ReferenceObjectLibrary", menuName = "XR/Reference Object Library", order = 3)]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.arsubsystems@4.0/manual/object-tracking.html")]
public class XRReferenceObjectLibrary : ScriptableObject
Properties
count
The number of reference objects in the library.
Declaration
public int count { get; }
Property Value
Type | Description |
---|---|
Int32 |
guid
A Guid
associated with this reference library.
The Guid is used to uniquely identify this library at runtime.
Declaration
public Guid guid { get; }
Property Value
Type | Description |
---|---|
Guid |
Item[Int32]
Get a reference object by index.
Declaration
public XRReferenceObject this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index in the array of reference objects. Must be greater than or equal to 0 and less than count. |
Property Value
Type | Description |
---|---|
XRReferenceObject | The XRReferenceObject at |
Methods
GetEnumerator()
Gets an enumerator which can be used to iterate over the reference objects in this library.
Declaration
public List<XRReferenceObject>.Enumerator GetEnumerator()
Returns
Type | Description |
---|---|
List.Enumerator<> | An |
Examples
This examples iterates over the reference objects contained in the library.
XRReferenceObjectLibrary library = ...
foreach (var referenceObject in library)
Debug.LogFormat("Reference object guid: {0}", referenceObject.guid);
indexOf(XRReferenceObject)
Get the index of referenceObject
in the object library.
Declaration
public int indexOf(XRReferenceObject referenceObject)
Parameters
Type | Name | Description |
---|---|---|
XRReferenceObject | referenceObject | The XRReferenceObject to find. |
Returns
Type | Description |
---|---|
Int32 | The zero-based index of the |