using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.XR.ARFoundation;
///
/// Displays information about each reference point including
/// whether or not the reference point is local or remote.
/// The reference point prefab is assumed to include a GameObject
/// which can be colored to indicate which session created it.
///
[RequireComponent(typeof(ARSessionOrigin))]
[RequireComponent(typeof(ARReferencePointManager))]
public class ReferencePointInfoManager : MonoBehaviour
{
[SerializeField]
ARSession m_Session;
public ARSession session
{
get { return m_Session; }
set { m_Session = value; }
}
void OnEnable()
{
GetComponent().referencePointsChanged += OnReferencePointsChanged;
}
void OnDisable()
{
GetComponent().referencePointsChanged -= OnReferencePointsChanged;
}
void OnReferencePointsChanged(ARReferencePointsChangedEventArgs eventArgs)
{
foreach (var referencePoint in eventArgs.added)
{
UpdateReferencePoint(referencePoint);
}
foreach (var referencePoint in eventArgs.updated)
{
UpdateReferencePoint(referencePoint);
}
}
unsafe struct byte128
{
public fixed byte data[16];
}
void UpdateReferencePoint(ARReferencePoint referencePoint)
{
var canvas = referencePoint.GetComponentInChildren