Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

unity event

using UnityEngine;
using UnityEngine.Events;


public class event_test : MonoBehaviour
{
    UnityEvent my_event=new UnityEvent();

    void Start()
    {
        my_event.AddListener(On_change);
    }
    void Update()
    {
        if(Input.GetKeyDown(KeyCode.Escape))
        {
            my_event.Invoke();
        }
    }
    void On_change()
    {
        Debug.Log("value changed to ");
    }
}
Source by vionixstudio.com #
 
PREVIOUS NEXT
Tagged: #unity #event
ADD COMMENT
Topic
Name
1+5 =