Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Does dynamic UnityEvents notify all suscribers?

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

  1. Jdedueas

    Jdedueas

    Joined:
    Nov 23, 2019
    Posts:
    6
    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. 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.