unityevent unity code example
Example: unityevent
using UnityEngine.Events;
// UnityEvents can also be serialized to the inspector
public class Foo : MonoBehaviour {
UnityEvent action;
void Start() {
action = new UnityEvent();
action.AddListener(() => { Debug.Log("Hello world!"); });
}
void Update() {
action.Invoke();
}
}