Added comments to everything

This commit is contained in:
djkellerman
2025-04-18 15:54:50 -04:00
parent a0305ea0e9
commit 213bb2d14b
39 changed files with 3166 additions and 1796 deletions

View File

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