Delegate Bindings: How to use references as payload Parameters

Dear Unreal Community,

[EDIT]Added the Delegate/Event Declaration[/EDIT]

I just wanted to do something like this:

// Delegate/Event Declaration in external class:
DECLARE_EVENT_OneParam(UManeuverExecutionMovementComponent, FManeuverFinishedEvent, FTransform)

// Header:
FTransform MyGlobalTransform;
FTransform EnemyGlobalTransform;
void OnManeuverFinished(FTransform Offset, FTransform& GlobalPosition);
// Source (Registration)
MyManeuverComponent.OnFinished().BindUObject(this, &AMyGameMode::OnManeuverFinished, MyGlobalTransform);
EnemyManeuverComponent.OnFinished().BindUObject(this, &AMyGameMode::OnManeuverFinished, EnemyGlobalTransform);

But I get compiler errors because there is no method with two FTransform arguments. I did already solve the issue by using pointer to actors (pointer to FTransform are not allowed for some reason).

I’m posting because I’m curious: Is there a helper like std::ref for such use cases?

Have a nice Day

Can you show your delegate declaration? Is it a regular delegate or a dynamic one?

My initial reaction though is this is a limitation of UE4’s delegate system, since I have a feeling I’ve run into the same thing myself at some point.

I have a lot of delegates with const ref parameters, myself.

For example:

DECLARE_MULTICAST_DELEGATE_OneParam(FOnReceiveProxies, const FNetworkedSpaceObjects&);
FOnReceiveProxies OnReceiveProxiesDelegate;

EDIT: Whoops, I misread. I’ve tried binding with reference and const reference like you have, and it doesn’t like it.

Thx for the responses. I edited my Post and added the declaration.

It seems like the binding of reference based payload data for delegates is not possible yet.
Easy work-around is to use a pointer to the object.
In case when UE forbids to expose a pointer, then a pointer to the owning object may do the trick.

I’m still curios if there is a std::ref equivalent in UE?