protected virtual void Start()
        {
            if (IsVR)
            {
                IVRTracker tracker = IOC.Resolve <IVRTracker>();
                m_input = new InputLowVR(tracker);
            }
            else
            {
                m_input = new InputLow();
            }
            SetInput();

            if (GetComponent <RTEBaseInput>() == null)
            {
                gameObject.AddComponent <RTEBaseInput>();
            }

            if (m_eventSystem == null)
            {
                m_eventSystem = FindObjectOfType <EventSystem>();
                if (m_eventSystem == null)
                {
                    GameObject eventSystem = new GameObject("EventSystem");
                    eventSystem.transform.SetParent(transform, false);
                    m_eventSystem = eventSystem.AddComponent <EventSystem>();
                    eventSystem.AddComponent <StandaloneInputModule>();
                }
            }

            if (m_object == null)
            {
                m_object = gameObject.AddComponent <RuntimeObjects>();
            }
        }
Exemple #2
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;
        }
Exemple #3
0
        protected virtual void Start()
        {
            if (GetComponent <RTEBaseInput>() == null)
            {
                gameObject.AddComponent <RTEBaseInput>();
            }

            if (m_object == null)
            {
                m_object = gameObject.AddComponent <RuntimeObjects>();
            }
        }
        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;
            }
        }
        protected virtual void OnDestroy()
        {
            IsOpened = false;

            if (m_object != null)
            {
                m_object = null;
            }

            if (m_dragDrop != null)
            {
                m_dragDrop.Reset();
            }
            if (((object)Instance) == this)
            {
                Instance = null;
            }
        }
        protected virtual void Start()
        {
            if (GetComponent <RTEBaseInput>() == null)
            {
                gameObject.AddComponent <RTEBaseInput>();
            }

            if (m_eventSystem == null)
            {
                m_eventSystem = FindObjectOfType <EventSystem>();
                if (m_eventSystem == null)
                {
                    GameObject eventSystem = new GameObject("EventSystem");
                    eventSystem.transform.SetParent(transform, false);
                    eventSystem.AddComponent <StandaloneInputModule>();
                    m_eventSystem = eventSystem.AddComponent <EventSystem>();
                }
            }

            if (m_object == null)
            {
                m_object = gameObject.AddComponent <RuntimeObjects>();
            }
        }