Unreal Engine/Error

[Unreal Engine 4 Error] 전방선언한 UENUM을 사용하는 함수를 구현 했을 때 방생하는 Unrecognized type Error

한돌이 2021. 12. 14. 22:33

에러가 발생한 상황

UENUM(BlueprintType)
enum class ERotationMode : uint8
{
	RotationMode_VelocityDirection	UMETA(DisplayName = "VelocityDirection"),
	RotationMode_LookingDirection	UMETA(DisplayName = "LookingDirection")
};

<Enum_PRRotationMode.h>

 

// 전방 선언
enum class ERotationMode : uint8;
    
UCLASS()
class PROJECTREPLICA_API APRPlayerCharacter : public APRCharacterBase
{
	GENERATED_BODY()
	
public:
	APRPlayerCharacter();
    
public:
	// 에러가 발생하는 함수
    UFUNCTION(BlueprintCallable, Category = "CharacterMovement")
	void SetRotationMode(ERotationMode NewRotationMode);
}

<PRPlayerCharacter.h>

 

#include "Enums/Enum_PRRotationMode.h"

APRPlayerCharacter::APRPlayerCharacter()
{
}

<PRPlayerCharacter.cpp>

 

 UENUM을 사용한 enum을 전방 선언으로 선언하고 이 enum을 사용하는 함수를 구현했습니다.

 

발생한 에러

해결 방법

void SetRotationMode(ERotationMode NewRotationMode);

 UFUNCTION을 사용하지 않고 함수를 구현합니다. UPROPERTY에서도 이와 같은 에러가 생긴다면 마찬가지로 UPROPERTY를 사용하지 않고 구현합니다.