Asking about The Event System and the numbers of the subscribers

i would like to ask since the event system is working with handler call back ,
can i add more than one function ( subscriber) to the event.
because is look simillar to the new input system way when i can add the movement functions to it.
just wanted to ask.

Regards
Hamam

Yes, you can. Anything that wants to know about the event can subscribe to it. One of the reasons it is important to unsubscribe is because you can accidentally subscribe multiple times and then you wonder why things are happening twice, and then 3 times, etc.

1 Like

Yup exactly an event can have as many subscribers as you want, there’s no limit.
They can be from any class, but yes you can also have multiple subscribers within the same class listening to the same event.
Although usually you probably don’t want to do that, if you do then the listener function will be called multiple times when the event is triggered. (if you add multiple listeners)

2 Likes

ok thanks , just wanted to make sure i was understanding it well.

ah ok , that’s a good reason to put only one. just wanted to make sure i was understanding the concept in good way

Privacy & Terms