using System.Collections; using System.Collections.Generic; using UnityEngine; public class EventConnect { System.Action OnChanged; public void Invoke(int type, object data) { if (OnChanged != null) OnChanged(type, data); } public void Add(System.Action OnChanged) { this.OnChanged += OnChanged; } public void Remove(System.Action OnChanged) { this.OnChanged -= OnChanged; } public void Clear() { this.OnChanged = null; } void EventCount() { if (OnChanged != null) Debug.Log($"OnChanged : {OnChanged.GetInvocationList().GetLength(0)}"); } }