Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Array of Delegates

Why is it not possible to make an array of delegates? And if it isn't, then why is it possible to do anyway? I couldn't find any source about it, but I don't see a reason why it couldn't be done thisway. Or if it is intended then how could an array of delegates be used?

alt text

Feature request part: It would be nice to store this as a variable also, since I'd use this array somewhere else too. Don't delegates work like the references? That I could pass around and it would still point at the very same event?

Product Version: UE 4.14 Preview
delegatearray.png (333.0 kB)
more ▼

asked Nov 02 '16 at 03:55 PM in Bug Reports

avatar image

531 25 25 43

avatar image CrimsonHawk Nov 02 '16 at 04:22 PM

I tried to do it with Select node, then I got the message that "Delegate is not compatible with Delegate (by ref)."

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Hello CrimsonHawk,

I was able to reproduce this issue on our end. I have written up a report and I have submitted it to the developers for further considerations. I have also provided a link to the public tracker. Please feel free to use the link provided for future updates. Thank you for your time and information.

Link: https://issues.unrealengine.com/issue/UE-38138

Make it a great day

more ▼

answered Nov 02 '16 at 06:31 PM

avatar image

Rudy Q ♦♦ STAFF
47.3k 545 132 525

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

While this does look like an interesting bug, I'm not sure why you would create an array of delegates.

Your example would work just fine if you take the custom event "ClickCard0" and connect it straight to the "BindEventOnClicked".

Every single card in that array, would trigger the ClickCard event binding and do that PrintString.

more ▼

answered Nov 02 '16 at 04:18 PM

avatar image

1.2k 31 8 33

avatar image CrimsonHawk Nov 02 '16 at 04:33 PM

There are cards in 5 positions (called Card Decks), and the PlayerController has to know if one of them are clicked, and must know exactly which one. (And I would also like to know if right or left mouse button, so there should be double if it is the Card that checks the R/L button.) Of course I don't want them to do the exact same thing, the PrintString is just there for testing. Since later the cards would be changed, these delegates should be unbound and bound to another card.

If I'd do it one by one without ForEachLoop, it would be much more ugly copy-paste work at a lot of places. If the bound events could get a variable from the event dispatcher, than I shouldn't even need multiple events (0,1,2...) for a very similar task.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question