using System; using System.Collections.Generic; namespace UnityEngine.XR.ARFoundation { /// /// Event arguments for the event. /// public struct ARMeshesChangedEventArgs : IEquatable { /// /// The list of MeshFilters added since the last event. /// public List added { get; } /// /// The list of MeshFilters updated since the last event. /// public List updated { get; } /// /// The list of MeshFilters removed since the last event. /// public List removed { get; } /// /// Constructs an . /// /// The list of MeshFilters added since the last event. /// The list of MeshFilters updated since the last event. /// The list of MeshFilters removed since the last event. public ARMeshesChangedEventArgs( List added, List updated, List removed) { this.added = added; this.updated = updated; this.removed = removed; } /// /// Generates a hash suitable for use with containers like `HashSet` and `Dictionary`. /// /// A hash code generated from this object's fields. public override int GetHashCode() => HashCodeUtil.Combine( HashCodeUtil.ReferenceHash(added), HashCodeUtil.ReferenceHash(updated), HashCodeUtil.ReferenceHash(removed)); /// /// IEquatable interface. /// /// The object to compare for equality. /// True if is of type /// and compares equal using . public override bool Equals(object obj) { return obj is ARMeshesChangedEventArgs args && Equals(args); } /// /// Generates a string representation of this struct, including the number of /// added, updated, and removed meshes. /// /// A string representation of this struct. public override string ToString() { return $"Added: {added?.Count ?? 0}, Updated: {updated?.Count ?? 0}, Removed: {removed?.Count ?? 0}"; } /// /// Compares for equality. /// /// The to compare for equality. /// True if , , and /// have the same List references as the corresponding properties of . public bool Equals(ARMeshesChangedEventArgs other) { return ReferenceEquals(added, other.added) && ReferenceEquals(updated, other.updated) && ReferenceEquals(removed, other.removed); } /// /// Compares for equality. Same as . /// /// The first to compare. /// The second to compare. /// The same value as public static bool operator ==(ARMeshesChangedEventArgs lhs, ARMeshesChangedEventArgs rhs) { return lhs.Equals(rhs); } /// /// Compares for inequality. Same as !. /// /// The first to compare. /// The second to compare. /// The same value as ! public static bool operator !=(ARMeshesChangedEventArgs lhs, ARMeshesChangedEventArgs rhs) { return !lhs.Equals(rhs); } } }