Files
ichni_Official/Assets/Modern UI Pack/Scripts/Demo/InputSystemChecker.cs

23 lines
629 B
C#
Raw Normal View History

2025-06-03 02:42:28 -04:00
using UnityEngine;
using UnityEngine.EventSystems;
#if ENABLE_INPUT_SYSTEM
using UnityEngine.InputSystem.UI;
#endif
namespace Michsky.MUIP
{
public class InputSystemChecker : MonoBehaviour
{
void Awake()
{
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
if (!gameObject.TryGetComponent<InputSystemUIInputModule>(out var tempModule))
{
gameObject.AddComponent<InputSystemUIInputModule>();
if (gameObject.TryGetComponent<StandaloneInputModule>(out var oldModule)) { Destroy(oldModule); }
}
#endif
}
}
}