Enum in function parameter cause error

i get the error Declaration is incompatible with int32 AMyCharacter::GetLevel( Level) const

Game.h

 UENUM(BlueprintType)
 enum class ECustomEnum : uint8
 {
     // 0 None
     None				UMETA(DisplayName = "None"),
 }

Character.h

UFUNCTION(BlueprintCallable, Category = "character")
	virtual int32 GetLevel(ECustomEnum Level) const;

Character.cpp

 int32 AMyCharacter::GetLevel(ECustomEnum Level) const
 {
     return 1;
 }

Is that the complete message? Also, is this code right?

Ok the the enum doesn’t hold the level

But this structure is the same

the main issue is that the enum as the func parameter is causing the error

 Declaration is incompatible with int32 AMyCharacter::GetLevel( <Error-Type> Level) const

Sorry, apart from the missing ; in the enum declaration, I still can’t see anything wrong with the code. It should compile.

Hi LS.master101

When you use Enums in blueprint functions, it’s best to declare them as bytes.

UFUNCTION(BlueprintCallable)
int32 MyFunction(TEnumAsByte<FMyCustomEnum> myEnum);

Hope this helps.

Alex