I started looking into delegates because I want to expose hookups in certain classes so that other classes may be notified, however I think that there’s 2 problems: a) documentation isn’t clear enough, b) the delegate system is just too complex.
(a) Delegate Documentation:
First of all, I think that out of the bat it doesn’t explain well what single cast vs multi cast vs multi cast dynamic.
- Single cast should have a one liner that says “you can only hookup one function to this delegate”.
- Multicast should have a one liner saying that it "allows you to add multiple hookups to this delegate, so multiple of them will execute.
- Dynamic Multicast is the same as multicast, but you don’t specify the arguments (afaict that’s the only difference).
- Events are Multicast, that can only be “executed” by the class they belong to.
Also there’s no place that mentions that for being able to use them in BP they have to be Dynamic Multicast or Events, this info is paramount and I only found it by some comment in the answers (please correct me if I’m wrong).
It should also mention that multicast does not do anything network wise. Given the terminology, at first I thought that multicast meant that it would be “multicast by the server”, which isn’t the case.
I also think that there should be actual examples of full start to finish on how they can be used (including hooking up to BP), atm this info is fragmented and a lot of times doesn’t come from official docs.
(B) Delegate API:
TBH I find it too confusing, and it seems for no reason. Maybe I’ve just been using C# for far too long, but looking into the delegates in UE brings back bad memories from my days with C++.
For example, when looking into Dynamic Multicast delegates, I saw people reference that you should call AddDynamic to add to the delegate. However, when I tried using it, the IDE didn’t show it to me. At first I thought it was a case of old APIs going away, but it turns out that it is a macro, but why use macro for such a thing?!
Macros shouldn’t be freely used (I’m of the opinion that they should be avoided at all cost) for things like this. It makes it much harder to use the engine (for example in this case the IDE didn’t show that the API existed), and furthermore it makes it much harder for new people to use the engine.
Second thing, is why even have single binding delegates? Like what’s the point? Does it add anything? IMO it only adds confusion, delegates should just be able to have N bindings, whomever wants to use only one can use the same thing.
The third thing is why have multicast and dynamic multicast? Is it for performance reasons? Even if multicast is a percentage better in terms of performance, does it make sense for it to exist given the incompatibility with BP system (again, correct me if I’m wrong)?
Looking at it, it seems that the only delegates that should exist are Events (assuming that the dynamic performance is much worse, otherwise dynamic ones are fair simpler to use).
Finally, the APIs are very all over the place. Some call bind / execute, others add / broadcast, tbh I think it would be easier for everybody if the APIs were all the same.