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
Assembly: Unity.XR.ARSubsystems.dll
Syntax
[CreateAssetMenu(fileName = "ReferenceObjectLibrary", menuName = "XR/Reference Object Library", order = 3)]
public class XRReferenceObjectLibrary : ScriptableObject, IEnumerable<XRReferenceObject>, IEnumerable
Properties
this[int]
Get a reference object by index.
Declaration
public XRReferenceObject this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
int | 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 |
See Also
count
The number of reference objects in the library.
Declaration
public int count { get; }
Property Value
Type | Description |
---|---|
int |
See Also
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 |
See Also
Methods
Add(XRReferenceObject)
Adds a new XRReferenceObject to this library.
Declaration
public void Add(XRReferenceObject referenceObject)
Parameters
Type | Name | Description |
---|---|---|
XRReferenceObject | referenceObject | The reference object to add. |
See Also
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<XRReferenceObject>.Enumerator | Returns an enumerator which can be used to iterate over the reference objects in this library. |
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);
}
See Also
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 |
---|---|
int | Returns the zero-based index of the |