using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class EventTest : MonoBehaviour
{
UnityEvent m_MyEvent;
// Use this for initialization
void Start ()
{
if (m_MyEvent == null)
m_MyEvent = new UnityEvent();
m_MyEvent.AddListener(Ping);
}
// Update is called once per frame
void Update ()
{
if (Input.anyKey && m_MyEvent != null)
{
m_MyEvent.Invoke();
}
}
void Ping()
{
Debug.Log("This is Ping");
}
}