using System; namespace UnityEngine.XR.ARKit { /// /// Represents an asynchronous world map request. /// Use this to determine the status of the request, /// and get the once the request is complete. /// public struct ARWorldMapRequest : IDisposable, IEquatable { /// /// Get the status of the request. /// public ARWorldMapRequestStatus status { get { return Api.UnityARKit_getWorldMapRequestStatus(m_RequestId); } } /// /// Retrieve the . /// It is an error to call this method when is /// not . /// /// An representing the state of the session at the time the request was made. public ARWorldMap GetWorldMap() { if (status != ARWorldMapRequestStatus.Success) throw new InvalidOperationException("Cannot GetWorldMap unless status is ARWorldMapRequestStatus.Success."); var worldMapId = Api.UnityARKit_getWorldMapIdFromRequestId(m_RequestId); if (worldMapId == ARWorldMap.k_InvalidHandle) throw new InvalidOperationException("Internal error."); return new ARWorldMap(worldMapId); } /// /// Dispose of the request. You must dispose of the request to avoid /// leaking resources. /// public void Dispose() { Api.UnityARKit_disposeWorldMapRequest(m_RequestId); } public override int GetHashCode() { return m_RequestId.GetHashCode(); } public override bool Equals(object obj) { if (!(obj is ARWorldMapRequest)) return false; return Equals((ARWorldMapRequest)obj); } public bool Equals(ARWorldMapRequest other) { return (m_RequestId == other.m_RequestId); } public static bool operator ==(ARWorldMapRequest lhs, ARWorldMapRequest rhs) { return lhs.Equals(rhs); } public static bool operator !=(ARWorldMapRequest lhs, ARWorldMapRequest rhs) { return !lhs.Equals(rhs); } internal ARWorldMapRequest(int requestId) { m_RequestId = requestId; } int m_RequestId; } }