☄️Tips & Code Examples
v1.0
Getting an OverlayIcon at Runtime
OverlayIcon at Runtime// In this example, we are grabbing the OverlayIcon associated with the
// Screen & Edge Overlay. You can also grab the NavigationBarIcon from
// the TrackedTargetOverlay if you wish.
public class MyScript : MonoBehaviour
{
private TrackedTargetOverlay _trackedTargetOverlay;
private OverlayIcon _overlayIcon;
private void Awake()
{
_trackedTargetOverlay = GetComponent<TrackedTargetOverlay>();
StartCoroutine(RegisterOverlayIcon());
}
private IEnumerator RegisterOverlayIcon()
{
while (_overlayIcon == null)
{
_overlayIcon = _trackedTargetOverlay.ScreenIcon;
if (_overlayIcon != null)
{
// Do additional actions here
yield break;
}
yield return null;
}
yield break;
}
}Get Distance to the Target
Check if Icon is on Screen, on Edge, or in Transition
Last updated