UnityEvent
Namespace: UnityEngine.Events
/
Inherits from: Events.UnityEventBase
Suggest a changeSuccess!
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseSumbission failed
For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
Close Switch to ManualDescription
A zero argument persistent callback that can be saved with the scene.
#pragma strict
var m_MyEvent : UnityEvent;
function Start ()
{
if (m_MyEvent == null)
m_MyEvent = new UnityEvent ();
m_MyEvent.AddListener (Ping);
}
function Update ()
{
if (Input.anyKeyDown && m_MyEvent != null)
{
m_MyEvent.Invoke ();
}
}
function Ping ()
{
Debug.Log ("Ping");
}
no example available in C#
Public Functions
AddListener | Add a non persistent listener to the UnityEvent. |
Invoke | Invoke all registered callbacks (runtime and peristent). |
RemoveListener | Remove a non persistent listener from the UnityEvent. |
Inherited members
Static Functions
GetValidMethodInfo | Given an object, function name, and a list of argument types; find the method that matches. |