It is a simple but useful custom event that can invoke multiple parameters.
using UnityEngine;
using CustomEventSystem;
public class ExampleInvokerScript : MonoBehaviour
{
private void Start()
{
CalculateSomething();
}
private void CalculateSomething()
{
int result = 7 + 3;
Events.IntegerEvent.Invoke(result);
}
}
using UnityEngine;
using CustomEventSystem;
public class ExampleListenerScript : MonoBehaviour
{
private void OnEnable()
{
Events.IntegerEvent.AddListener(DoSomething);
}
private void OnDisable()
{
Events.IntegerEvent.RemoveListener(DoSomething);
}
private void DoSomething(int i)
{
Debug.Log(i);
}
}