|
|
|
|
|
|
|
|
|
|
void OnEnable() |
|
|
|
{ |
|
|
|
m_ARPlaneManager.planesChanged += OnPlanesAdded; |
|
|
|
m_ARPlaneManager.planesChanged += OnPlanesUpdated; |
|
|
|
m_ARPlaneManager.planesChanged += OnPlanesRemoved; |
|
|
|
m_ARPlaneManager.planesChanged += OnPlanesChanged; |
|
|
|
m_ARPlaneManager.planesChanged -= OnPlanesAdded; |
|
|
|
m_ARPlaneManager.planesChanged -= OnPlanesUpdated; |
|
|
|
m_ARPlaneManager.planesChanged -= OnPlanesRemoved; |
|
|
|
m_ARPlaneManager.planesChanged -= OnPlanesChanged; |
|
|
|
} |
|
|
|
|
|
|
|
void OnPlanesChanged(ARPlanesChangedEventArgs eventArgs) |
|
|
|
{ |
|
|
|
OnPlanesAdded(eventArgs.added); |
|
|
|
OnPlanesUpdated(eventArgs.updated); |
|
|
|
OnPlanesRemoved(eventArgs.removed); |
|
|
|
void OnPlanesAdded(ARPlanesChangedEventArgs eventArgs) |
|
|
|
void OnPlanesAdded(List<ARPlane> addedPlanes) |
|
|
|
foreach (var plane in eventArgs.added) |
|
|
|
foreach (var plane in addedPlanes) |
|
|
|
{ |
|
|
|
GameObject textObj = new GameObject(); |
|
|
|
textObj.transform.SetParent(plane.gameObject.transform, false); |
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void OnPlanesUpdated(ARPlanesChangedEventArgs eventArgs) |
|
|
|
void OnPlanesUpdated(List<ARPlane> updatedPlanes) |
|
|
|
foreach (var plane in eventArgs.updated) |
|
|
|
foreach (var plane in updatedPlanes) |
|
|
|
{ |
|
|
|
TextMesh planeText = plane.GetComponentInChildren<TextMesh>(); |
|
|
|
if (planeText) |
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void OnPlanesRemoved(ARPlanesChangedEventArgs eventArgs) |
|
|
|
void OnPlanesRemoved(List<ARPlane> removedPlanes) |
|
|
|
foreach (var plane in eventArgs.removed) |
|
|
|
foreach (var plane in removedPlanes) |
|
|
|
{ |
|
|
|
Component[] textMeshes; |
|
|
|
|
|
|
|