Custom Event in inspector

How i can create something like it in my script

120435-events.png

I try with it but doesnt work

class MyClass : MonoBehaviour {

	public delegate void OnActionElement ();
	public event OnActionElement destroy;

}

The solution is here "https://answers.unity.com/questions/984182/custom-event-handler-in-inspector.html" ...

–

1 Answer

1

@vzenix
Use UnityEngine.Events to make it.

Something like:

using UnityEngine.Events;
        
public UnityEvent myEvent;
    
void Update () {
    if(Input.GetKeyDown(KeyCode.Space)){
        myEvent.Invoke();
    }
}

public void someFunction() {
    print("here");
}

And assign someFunction() in the inspector.