I am trying to replicate a function that has a custom enum type as parameter.
.h
UFUNCTION(Server, Reliable, WithValidation)
void ServerSetTeam(TEnumAsByte<EKaoriGameTeam::Type> NewTeam);
.cpp
bool AKaoriTeam::ServerSetTeam_Validate(TEnumAsByte<EKaoriGameTeam::Type> NewTeam)
{
return true;
}
void AKaoriTeam::ServerSetTeam_Implementation(TEnumAsByte<EKaoriGameTeam::Type> NewTeam)
{
Team = NewTeam;
}
If I try to build my game I get the following error
19> …\KaoriTeam.cpp(48): error C2511: ‘bool AKaoriTeam::ServerSetTeam_Validate(TEnumAsByte)’ : overloaded member function not found in ‘AKaoriTeam’
19> …\KaoriTeam.h(15) : see declaration of ‘AKaoriTeam’
19> …\KaoriTeam.cpp(53): error C2511: ‘void AKaoriTeam::ServerSetTeam_Implementation(TEnumAsByte)’ : overloaded member function not found in ‘AKaoriTeam’
19> …\KaoriTeam.h(15) : see declaration of ‘AKaoriTeam’
19> …\Kaori.generated.inl(116): error C2511: ‘void AKaoriTeam::ServerSetTeam(EKaoriGameTeam::Type)’ : overloaded member function not found in ‘AKaoriTeam’
19> …\KaoriTeam.h(15) : see declaration of ‘AKaoriTeam’
If I only change the parameter from TEnumAsByte to lets say uint32 everything works fine.
EDIT: Ok I removed the TEnumAsByte and only use EKaoriGameTeam::Type now it works but at some point the compiler told me that I should use TEnumAsByte if I want to use my Enum, When do I need TEnumAsByte and when not?