[C++] Is it possible to make interface function non-const?

Good day!
I’m making my own UInterface as shown:

UINTERFACE(MinimalAPI, Blueprintable)
class UDialogueSubWidgetInterface : public UInterface
{
	GENERATED_UINTERFACE_BODY()
};

class DIALOGUESYSTEM_API IDialogueSubWidgetInterface
{
	GENERATED_IINTERFACE_BODY()

public:

	UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Dialogue")
	bool SetNPC(APawn* NPC);

};

I’m calling SetNPC this kind of way

if (SubWidgetObj->Implements<UDialogueSubWidgetInterface>())
		{
			IDialogueSubWidgetInterface::Execute_SetNPC(SubWidgetObj, OwnerComp.GetAIOwner()->GetPawn());
		}

All of code is basic. Next I’m creating my widget, implements my interface and trying to override SetNPC like this:

As shown, I’m trying to set my widget variable. But I don’t allowed to do that, 'cause it’s const function. Can I make it non-const?

I am really not sure about this but please do try using a reference instead of a pointer:

bool SetNPC(UPARAM(ref) APawn& NPC);

and use “SetVariableByRef” macro in your blueprint.

(UPARAM macro and SetVariableByRef might not be needed but I slapped them in just in case)

The function doesn’t look like it’s const. It seems to me that the Pawn variable you have must be set to BlueprintReadOnly (which is effectually const in blueprint) and thus can’t be “Set”; you can only “Get” the variable. Did you add that variable in C++ or through the blueprint?

Regardless, try adding a new variable in blueprint, like a float or something, and without changing anything about it drag it into the graph and “Set” it to something and hit compile. If it compiles then you know the problem is with the Pawn variable and not the const-ness of the function. Get rid of the Pawn variable first though before testing that.