Ejemplo n.º 1
0
        protected virtual void Awake()
        {
            if (m_instance != null)
            {
                Debug.LogWarning("Another instance of RTE exists");
                return;
            }
            if (m_useBuiltinUndo)
            {
                m_undo = new RuntimeUndo(this);
            }
            else
            {
                m_undo = new DisabledUndo();
            }

            if (m_raycaster == null)
            {
                m_raycaster = GetComponent <GraphicRaycaster>();
            }

            IsVR            = UnityEngine.XR.XRDevice.isPresent && m_enableVRIfAvailable;
            m_selection     = new RuntimeSelection(this);
            m_dragDrop      = new DragDrop(this);
            m_object        = gameObject.GetComponent <RuntimeObjects>();
            m_disabledInput = new DisabledInput();
            m_activeInput   = m_disabledInput;

            m_instance = this;

            bool isOpened = m_isOpened;

            m_isOpened = !isOpened;
            IsOpened   = isOpened;
        }
Ejemplo n.º 2
0
        protected virtual void Awake()
        {
            if (Instance != null)
            {
                Debug.LogWarning("Another instance of RTE exists");
                return;
            }
            if (m_useBuiltinUndo)
            {
                m_undo = new RuntimeUndo(this);
            }
            else
            {
                m_undo = new DisabledUndo();
            }

            m_uiRaycaster = IOC.Resolve <IUIRaycaster>();
            if (m_uiRaycaster == null)
            {
                m_uiRaycaster = GetComponentInChildren <IUIRaycaster>();
            }

            IsVR            = /*UnityEngine.XR.XRDevice.isPresent*/ false && m_enableVRIfAvailable;
            m_selection     = new RuntimeSelection(this);
            m_dragDrop      = new DragDrop(this);
            m_object        = gameObject.GetComponent <RuntimeObjects>();
            m_disabledInput = new DisabledInput();
            m_activeInput   = m_disabledInput;

            Instance = this;

            bool isOpened = m_isOpened;

            m_isOpened = !isOpened;
            IsOpened   = isOpened;

            if (m_createHierarchyRoot)
            {
                GameObject hierarchyRoot = GameObject.FindGameObjectWithTag(ExposeToEditor.HierarchyRootTag);
                if (hierarchyRoot == null)
                {
                    hierarchyRoot = new GameObject("HierarchyRoot");
                }
                hierarchyRoot.transform.position = Vector3.zero;
                hierarchyRoot.tag = ExposeToEditor.HierarchyRootTag;
            }
        }