Exemplo n.º 1
0
        public static void Initialize()
        {
            if (Active || isApplicationQuitting)
            {
                return;
            }

            var instances = FindObjectsOfType <NRInputModule>();

            if (instances.Length > 0)
            {
                m_Instance = instances[0];
                if (instances.Length > 1)
                {
                    NRDebugger.LogWarning("Multiple NRInputModule not supported!");
                }
            }

            if (!Active)
            {
                EventSystem eventSystem = EventSystem.current;
                if (eventSystem == null)
                {
                    eventSystem = FindObjectOfType <EventSystem>();
                }
                if (eventSystem == null)
                {
                    eventSystem = new GameObject("[EventSystem]").AddComponent <EventSystem>();
                }
                if (eventSystem == null)
                {
                    NRDebugger.LogWarning("EventSystem not found or create fail!");
                    return;
                }

                m_Instance = eventSystem.gameObject.AddComponent <NRInputModule>();
                DontDestroyOnLoad(eventSystem.gameObject);
            }
        }
Exemplo n.º 2
0
 protected override void OnDisable()
 {
     //base.OnDisable();
     NRInputModule.RemoveRaycaster(this);
 }
Exemplo n.º 3
0
 // override OnEnable & OnDisable on purpose so that this BaseRaycaster won't be registered into RaycasterManager
 protected override void OnEnable()
 {
     //base.OnEnable();
     NRInputModule.AddRaycaster(this);
 }