using UnityEngine; using System.Collections.Generic; public class LightManager : MonoBehaviour { static LightManager s_Instance; HashSet m_Container = new HashSet(); static LightManager Instance { get { if (s_Instance != null) return s_Instance; s_Instance = (LightManager) FindObjectOfType(typeof(LightManager)); return s_Instance; } } public static HashSet Get() { LightManager instance = Instance; return instance == null ? new HashSet() : instance.m_Container; } public static bool Add(T t) { LightManager instance = Instance; if (instance == null) return false; instance.m_Container.Add(t); return true; } public static void Remove(T t) { LightManager instance = Instance; if (instance == null) return; instance.m_Container.Remove(t); } }