I’m creating a tool in which users can use Blueprint and C++ delegates. I’m wondering if there is a preferred or correct way to pass structs in Delegates.
I know technical difference between passing by value and by ref. I’m just wondering if any of these is better for Blueprints reflections system.
AI Chat scared me with this sentence: **Only trivial USTRUCTs should be passed by const& in dynamic delegates**.
So looking for more experienced devs opinion
As I haven’t received any answer here I tried to read all possible resources and chat with multiple bots. I ended up passing by value in DYNAMIC delegates and by reference in non Dynamic/Native ones:
Ahh ok, that might be the case. I declared all my Delegates in C++, so they are usable in C++ and Blueprints.
I haven’t tried BP event dispatcher for this case. Thanks for checking!
I appreciate you showing this by the way. I was having a rough time setting a delegate and realized that the Native (C++) option is a lot faster than the reflected one (Dynamic is reflected - non-dynamic isn’t).
I must also not use UFUNCTION() and UPROPERTY() on the Native delegate (mandatory for a DYNAMIC one).
Much appreciated for sharing this. It helped me in a rather unintended way but this is very important for my work.