Unityevents???

Can someone explain to me what this means - especially #1 (+ sign to add a slot)
Thanks!
taken from

Using UnityEvents

To configure a callback in the editor there are a few steps to take:

  • Select the + icon to add a slot for a callback

  • Select the UnityEngine.Object you wish to receive the callback (You can use the object selector for this)

  • Select the function you wish to be called

  • You can add more then one callback for the event


Ok, after some fiddling around I got it…

So to add a callback, your MonoBehaviour has to have a UnityEvent in it :

using UnityEngine;
using UnityEngine.Events;
using System.Collections;

public class test : MonoBehaviour {

    public UnityEvent myEvent;

    void Update () {
   
    }
}

Make sure you add “Using UnityEngine.Events”!
You will then be able to find the + icon yourself in the editor ;))

1 Like

Cool.