EventSystemChecker.cs 578 B

1234567891011121314151617181920212223
  1. using System;
  2. using System.Collections;
  3. using UnityEngine;
  4. using UnityEngine.EventSystems;
  5. public class EventSystemChecker : MonoBehaviour
  6. {
  7. //public GameObject eventSystem;
  8. // Use this for initialization
  9. void Awake ()
  10. {
  11. if(!FindObjectOfType<EventSystem>())
  12. {
  13. //Instantiate(eventSystem);
  14. GameObject obj = new GameObject("EventSystem");
  15. obj.AddComponent<EventSystem>();
  16. //obj.AddComponent<StandaloneInputModule>().forceModuleActive = true;
  17. obj.AddComponent<StandaloneInputModule>();
  18. }
  19. }
  20. }