using UnityEngine; using UnityEngine.EventSystems; #if ENABLE_INPUT_SYSTEM using UnityEngine.InputSystem.UI; #endif namespace LowPolyCharacterCollection3 { [DisallowMultipleComponent] public class EventSystemEnsurer : MonoBehaviour { private void Awake() { if (FindObjectOfType() == null) { var go = new GameObject("EventSystem"); go.AddComponent(); #if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER go.AddComponent(); Debug.Log("[EventSystemEnsurer] No EventSystem found — created one with InputSystemUIInputModule."); #else go.AddComponent(); Debug.Log("[EventSystemEnsurer] No EventSystem found — created one with StandaloneInputModule."); #endif } } } }