Download

function declaration with the same name with different nb of argument doesn't build

Hi,

Let say that I want to do in my header file:

UFUNCTION()
FStringAssetReference getDefaultPawn(EName::Type Name);

UFUNCTION()
FStringAssetReference getDefaultPawn(EName::Type Name, uint8 Level);

Here is the error that I have:
1>…MyTest.h(19): error : In MyTest: ‘getDefaultPawn’ conflicts with ‘Function /Script/MyGame.MyTest:getDefaultPawn’

I’m not an expert in C++, but I can’t see what’s wrong in those function definition. They don’t have the same number of parameters. Is it a UE constraint?

Thanks,

I’m pretty sure you can’t overload UFUNCTION() :slight_smile:

If you dont need the UFUNCTION() for any network-code related reason, or for keybinding, I’d just take the UFUNCTION() out and do regular c++ overloading :slight_smile:

Rama

This has been confirmed on Answer Hub.

Thanks for the answer.