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");
}
using UnityEngine;
using UnityEngine.Events;
using System.Collections;
public class ExampleClass : MonoBehaviour {
UnityEvent m_MyEvent;
void Start() {
if (m_MyEvent == null)
m_MyEvent = new UnityEvent ();
m_MyEvent.AddListener (Ping);
}
void Update() {
if (Input.anyKeyDown && m_MyEvent != null)
{
m_MyEvent.Invoke ();
}
}
void Ping() {
Debug.Log ("Ping");
}
}