Search Unity

Are UnityEvent's delegates?

Discussion in 'UGUI & TextMesh Pro' started by User340, Aug 20, 2014.

  1. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    Is the UnityEvent type a delegate or class? I noticed that you subclass UnityEvent to create your own events. If it's not a delegate type, is it just a plain old class?

    Does the new UI use c# delegates/events at all, or does it completely bypass them?
     
  2. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    There are two sides to the UnityEvents, the serialization side (referencing the target and the method / arguments) and then the runtime invocation side. The serialization side is a class that holds all the data that needs to be remembered, the first time invoke is called on the UnityEvent we build this into a multicast delegate.

    So internally we do use delegates / events :)
     
    User340 likes this.
  3. The-Oddler

    The-Oddler

    Joined:
    Nov 26, 2010
    Posts:
    133
    Can the source code of this be seen? As with the rest of the UI?
    I searched in the Bitbucket repo, but couldn't find it. Is this not part of the open-source ui, or did I just miss it somewhere?
     
    Joviex likes this.