Example #1
0
        public static void Initialize()
        {
            if (Active || isApplicationQuitting)
            {
                return;
            }

            var instances = FindObjectsOfType <Pointer3DInputModule>();

            if (instances.Length > 0)
            {
                instance = instances[0];
                if (instances.Length > 1)
                {
                    Debug.LogWarning("Multiple Pointer3DInputModule not supported!");
                }
            }

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

                instance = eventSystem.gameObject.AddComponent <Pointer3DInputModule>();
                instance.SetCoexistValue(false);
            }
        }