0

What are the main props of delegates in UE4?

I read a lot about them and not sure, why default virtual function as BeginOverlap/Notify/End/etc is not enough?

Can we use one delegate for a few functions? I mean, If I will declare simple delegate somewhere:

DECLARE_DELEGATE(FStandartDelegateSignature)

Can I bind the different functions to him or only one-to-one relation? I'm really don't get any idea why this is so good?

If I want to interact with some Actor, why I can just implement virtual void OnOverlap and add all the logic at that point? What is the benefit from the declare the first delegate, and after that add this to the OnOverlap.

Can somebody, please, describe one good example to close that gap because I have any idea why we really need to use delegates?

  • As written, this question has too many parts to be adequately answered in one answer. As for your first meaningful question: "why default virtual function is not enough?": does this answer your question? [Where do I use delegates?](https://stackoverflow.com/questions/31497/where-do-i-use-delegates) – Ruzihm Feb 05 '20 at 20:12
  • @Ruzihm, thanks for the link, but it does not really answer the question. I've already seen this topic before. At least, I want to understand if we can bind only `one-to-one` delegates or make something better. –  Feb 05 '20 at 20:15
  • 1
    `DECLARE_DELEGATE` allows you to make many instances of that delegate type. Each instance can refer to exactly one function, but multiple instances can refer to the same function. In this sense, it is a **many-to-one** relationship. See [here](https://stackoverflow.com/questions/17959246/virtual-function-vs-function-pointer-performance) for a discussion of using virtual functions vs function pointers (which DECLARE_DELEGATE uses) – Ruzihm Feb 05 '20 at 20:43

0 Answers0