[Interface] Automatic Blueprint implementation differs from signature

Hi everyone,

I am trying to implement an Interface from a Blueprint, but it’s getting quite tricky, I don’t get what is happening…

I have a simple interface here :

#.h

#pragma once

#include "Components/WidgetComponent.h"
#include "InteractiveUIInterface.generated.h"

UINTERFACE(MinimalAPI)
class UInteractiveUIInterface : public UInterface
{
	GENERATED_UINTERFACE_BODY()
};

class IInteractiveUIInterface
{
	GENERATED_IINTERFACE_BODY()

	UFUNCTION(BlueprintImplementableEvent)
	bool OnButtonTriggered(int32 ID);

	UFUNCTION(BlueprintImplementableEvent)
	bool CreateTrigger(FTransform &triggerTransform, UWidgetComponent *&parent, int32 ID);
};

#.cpp

#include "SimulateurVR3D.h"
#include "InteractiveUIInterface.h"

UInteractiveUIInterface::UInteractiveUIInterface(const class FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{

}

Here, nothing special, it compile, and I can choose to implement my interface in my blueprint.
But, if I go to the newly implemented function “CreateTrigger()”, here’s what I get :

43545-interfaceimplementation.png

Which differs slightly from what I asked… Two of my parameters are converted into return values…

I don’t know what I missed, I tried a few things, nothing seems to work better

Is anyone got an idea of what’s going on ?

Thanks !

Hello, Ismuur

Please note that when you declare function parameter as a reference, Blueprint assumes that it is a return value, since in some functions you may pass a reference to the variable in which the result value should be stored.

In this case, please also consider the fact that the Unreal property system that Blueprints are built on only supports passing pointers to non-UObjects (but not UStructs).

Thus, please declare your method like this:

UFUNCTION(BlueprintImplementableEvent)
bool CreateTrigger(FTransform triggerTransform, UWidgetComponent *parent, int32 ID);

This should do it.

Hope this helped!

Have a great day!

Thanks a lot, you saved my day !

You are welcome! Good luck!