Files
VR-WuKong/Assets/ThirdParty/BruteForce/Scripts/BF_InputSystemSwitcher.cs

32 lines
886 B
C#
Raw Normal View History

2025-11-14 18:44:06 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
#if ENABLE_INPUT_SYSTEM
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.UI;
#endif
public class BF_InputSystemSwitcher : MonoBehaviour
{
public GameObject eventS;
// Start is called before the first frame update
void Awake()
{
#if ENABLE_INPUT_SYSTEM
if (eventS.GetComponent<InputSystemUIInputModule>() == null)
{
if(eventS.GetComponent<StandaloneInputModule>() != null)
{
Destroy(eventS.GetComponent<StandaloneInputModule>());
}
InputSystemUIInputModule inputSystem = eventS.AddComponent<InputSystemUIInputModule>();
inputSystem.enabled = false;
inputSystem.enabled = true;
inputSystem.UpdateModule();
}
#endif
}
}