public void SOEventTests() { //create event var ev = EventSO.CreateInstance <EventSO>(); //add listener var evLis = new EventSOTester(); ev.Add(evLis); //invoke ev.Fire(); //assert value matches Assert.IsTrue(evLis.hasBeenFired); //destroy event UnityEngine.Object.DestroyImmediate(ev); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); EventSO eventso = target as EventSO; EditorGUILayout.Space(); EditorGUILayout.PrefixLabel("Current Listeners: " + eventso.ListenerCount.ToString()); if (Application.isPlaying && GUILayout.Button("Fire")) { eventso.Fire(); } if (GUILayout.Button(new GUIContent("Attempt to Ping all Listeners", "Cannot ping Objects that are not monobehaviours"))) { EditorUTIL.PingElements(eventso.Listeners); } }
public void OnEventFired(EventSO origin) { unityEvent.Invoke(); }
public void OnEventFired(EventSO origin) { hasBeenFired = true; }