Files
Cielonos/Assets/Shift - Complete Sci-Fi UI/Scripts/Input/InputSystemDetector.cs

27 lines
643 B
C#
Raw Normal View History

2026-06-12 17:11:39 -04:00
using UnityEngine;
2025-11-25 08:19:33 -05:00
#if ENABLE_INPUT_SYSTEM
using UnityEngine.InputSystem.UI;
2026-06-12 17:11:39 -04:00
#else
using UnityEngine.EventSystems;
2025-11-25 08:19:33 -05:00
#endif
2026-06-12 17:11:39 -04:00
namespace Evo.UI.Demo
2025-11-25 08:19:33 -05:00
{
2026-06-12 17:11:39 -04:00
public class InputSystemDetector : MonoBehaviour
2025-11-25 08:19:33 -05:00
{
void Awake()
{
2026-06-12 17:11:39 -04:00
#if ENABLE_INPUT_SYSTEM
if (!gameObject.TryGetComponent<InputSystemUIInputModule>(out var _))
2025-11-25 08:19:33 -05:00
{
gameObject.AddComponent<InputSystemUIInputModule>();
2026-06-12 17:11:39 -04:00
}
#else
if (!gameObject.TryGetComponent<StandaloneInputModule>(out var _))
{
gameObject.AddComponent<StandaloneInputModule>();
2025-11-25 08:19:33 -05:00
}
#endif
}
}
}