using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.XR.ARFoundation;
namespace UnityEngine.XR.ARFoundation.Samples
{
///
/// 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(ARAnchorManager))]
public class AnchorInfoManager : MonoBehaviour
{
[SerializeField]
ARSession m_Session;
public ARSession session
{
get { return m_Session; }
set { m_Session = value; }
}
void OnEnable()
{
GetComponent().anchorsChanged += OnAnchorsChanged;
}
void OnDisable()
{
GetComponent().anchorsChanged -= OnAnchorsChanged;
}
void OnAnchorsChanged(ARAnchorsChangedEventArgs eventArgs)
{
foreach (var referencePoint in eventArgs.added)
{
UpdateAnchor(referencePoint);
}
foreach (var referencePoint in eventArgs.updated)
{
UpdateAnchor(referencePoint);
}
}
unsafe struct byte128
{
public fixed byte data[16];
}
void UpdateAnchor(ARAnchor referencePoint)
{
var canvas = referencePoint.GetComponentInChildren