Example #1
0
        public Transform BuildPath(NavigationTargetListButton button)
        {
            m_CameraTransform = Camera.main.transform;
            m_TargetTransform = button.targetObject.transform;

            // check if main camera exists
            if (m_CameraTransform == null)
            {
                Debug.Log("Could not find the main camera. Do you have the MainCamera tag applied?");
                return(null);
            }

            // check if target from button was found
            if (m_TargetTransform == null)
            {
                Debug.Log("Target not found");
                return(null);
            }

            // check if AR Space exists
            if (m_ARSpace == null)
            {
                arSpace = gameObject.GetComponentInParent <Immersal.AR.ARSpace>();
                if (arSpace == null)
                {
                    Debug.Log("No AR Space found. Does one exist in scene?");
                    return(null);
                }
            }

            m_IsInitialized     = true;
            m_NavigationArrived = false;
            UpdatePath(false);

            // create the compass m_Arrow
            if (m_ArrowPrefab != null)
            {
                m_Arrow          = Instantiate(m_ArrowPrefab, m_CameraTransform.transform);
                m_ArrowDirection = m_Arrow.GetComponent <LookTowardsTarget>();
                m_Arrow.SetActive(false);
            }

            return(m_TargetTransform);
        }