EventSystemChecker.cs 521 B

123456789101112131415161718192021
  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. }
  18. }
  19. }