Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Does dynamic UnityEvents notify all suscribers?

Discussion in 'Documentation' started by Jdedueas, Mar 15, 2021.

  1. Jdedueas


    Nov 23, 2019
    Hello, as the title says, I have a question about dyanmic UnityEvents. From the documentation:

    Dynamic calls are invoked using an argument that is sent from code, and this is bound to the type of UnityEvent that is being invoked. The UI filters the callbacks and only shows the dynamic calls that are valid for the UnityEvent.

    What this exactly mean? I dont know how to interpret it. Does all methods suscribed to the dynamic UnityEvent recieve the callback but just the ones that have the valid argument run the method?

    For give some context, I just want to have a clear idea about the dynamic UnityEvents performance.
  2. Lurking-Ninja


    Jan 20, 2015
    You could just test it.
    (I recommend to test things to everyone who is learning stuff, doing is more valuable than reading/watching only.)

    But since you didn't: you can't subscribe to an event with a method which doesn't accept the exact number and type of parameters the event describes. So yes, all subscribed methods will receive the call.
    Jdedueas likes this.