How to properly insert Engine-Default Enums in FStructs

atanknomore
Sat, 27 Oct 2018 19:46:19 +0000
Editor Scripting

I’m trying to make an FStruct to facilitate Function Input communication for Tracing. I’m using the instructions from this page:

docs.unrealengine.com

Coding Standard

Standards and conventions used by Epic Games in the Unreal Engine 4 codebase.

Here’s the .h

USTRUCT(BlueprintType) struct FMakeTraceInfo //Declaration. This Struct is used to Reduce FunctionInput Node sizes.
{
	GENERATED_BODY()

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HitInformation")
	ETraceTypeQuery TraceType;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HitInformation")
	bool TraceComplex;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HitInformation")
	EDrawDebugTrace DrawType;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HitInformation")
	TArray<AActor*> IgnoreArray;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HitInformation")
	bool IgnoreSelf;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HitInformation")
	FLinearColor TraceColor;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HitInformation")
	float DrawTime;

However, compiling this produces the following error:
“You cannot Use Raw Enum Name as a Type. Instead, use TEnumAsByte or a C++11 Enum Class with Explicit Underlying Type.”

If I use

TEnumAsByte <ETraceTypeQuery>

is says illegal use (with reason), and if I use

TEnumAsByte<ETraceTypeQuery::Type>

it says that it TEnumAsByte cannot convert to ETraceTypeQuery. I’m guessing that the proper way is by including it as a C++11 type. How would I include it this way?

4 posts - 3 participants