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;
}
EvilCleric
(EvilCleric)
2
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
EvilCleric
(EvilCleric)
4
Sorry, apart from the missing ; in the enum declaration, I still can’t see anything wrong with the code. It should compile.
Alekann01
(Alekann01)
5
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