Answers for "unityevent"

C#
1

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();
  }
}
Posted by: Guest on August-28-2020

Code answers related to "unityevent"

C# Answers by Framework

Browse Popular Code Answers by Language