using UnityEngine; using Game; using Music; using Player; using UnityEngine.EventSystems; namespace Game { /// /// This class makes sure there is only one EventSystem in the game at any time. /// public class EventSystemizer : MonoBehaviour { /// /// Checks every frame to ensure there is only one EventSystem in the game. /// private void Update() { // Find all EventSystem objects in the scene foreach (EventSystem system in FindObjectsByType(FindObjectsSortMode.None)) { // Skip the EventSystem attached to this GameObject if (system == GetComponent()) continue; // Remove any extra EventSystem objects Destroy(system.gameObject); } } } }