Dear Friends at Epic,
I am getting a misleading compile error when I try to use TEnumAsByte within the function parameters of a server function!
#TEnumAsByte for This Enum
UENUM(BlueprintType)
namespace EJoyMovement
{
//256 entries max
enum Type
{
Hover UMETA(DisplayName="Hover"),
Rolling UMETA(DisplayName="Rolling"),
Ground UMETA(DisplayName="Ground"),
//~~~
//256th entry
EJoyMovement_Max UMETA(Hidden),
};
}
#The Compiler
The compiler simply says it cant find the function, which is very misleading.
Really the issue is is that you can’t use TEnumAsByte with replicated functions, at the moment.
Though I can’t see why this is an existing limitation?
#This Works
UFUNCTION(reliable, server, WithValidation)
void SERVER_SetJoyMove(EJoyMovement::Type NewJoyMode);
cpp
bool AJoyMovement::SERVER_SetJoyMove_Validate(EJoyMovement::Type NewJoyMode)
{
return true;
}
void AJoyMovement::SERVER_SetJoyMove_Implementation(EJoyMovement::Type NewJoyMode)
{
#This Doesnt
UFUNCTION(reliable, server, WithValidation)
void SERVER_SetJoyMove(TEnumAsByte<EJoyMovement::Type> NewJoyMode);
cpp
bool AJoyMovement::SERVER_SetJoyMove_Validate(TEnumAsByte<EJoyMovement::Type> NewJoyMode)
{
return true;
}
void AJoyMovement::SERVER_SetJoyMove_Implementation(TEnumAsByte<EJoyMovement::Type> NewJoyMode)
{
#Compile Error
1>C:\Users\\Documents\Unreal Projects\JoyShapes\Intermediate\Build\Win64\Inc\JoyShapes\JoyShapes.generated.cpp(1104): error C2511: 'void AJoyMovement::SERVER_SetJoyMove(EJoyMovement::Type)' : overloaded member function not found in 'AJoyMovement'
1> C:\Users\\Documents\Unreal Projects\JoyShapes\Source\JoyShapes\Private\Characters\JoyMovement.h(14) : see declaration of 'AJoyMovement'
1>C:\Users\\Documents\Unreal Projects\JoyShapes\Intermediate\Build\Win64\Inc\JoyShapes\JoyShapes.generated.cpp(1107): error C2352: 'UObject::FindFunctionChecked' : illegal call of non-static member function
1> e:\victoryue4\unrealengine-4.2\engine\source\runtime\coreuobject\public\uobject\UObject.h(568) : see declaration of 'UObject::FindFunctionChecked'
1>C:\Users\\Documents\Unreal Projects\JoyShapes\Source\JoyShapes\Private\Characters\JoyMovement.cpp(28): error C2511: 'bool AJoyMovement::SERVER_SetJoyMove_Validate(TEnumAsByte<EJoyMovement::Type>)' : overloaded member function not found in 'AJoyMovement'
1> c:\users\\documents\unreal projects\joyshapes\source\joyshapes\private\characters\JoyMovement.h(14) : see declaration of 'AJoyMovement'
1>C:\Users\\Documents\Unreal Projects\JoyShapes\Source\JoyShapes\Private\Characters\JoyMovement.cpp(33): error C2511: 'void AJoyMovement::SERVER_SetJoyMove_Implementation(TEnumAsByte<EJoyMovement::Type>)' : overloaded member function not found in 'AJoyMovement'
1> c:\users\\documents\unreal projects\joyshapes\source\joyshapes\private\characters\JoyMovement.h(14) : see declaration of 'AJoyMovement'
#