# How to properly insert Engine-Default Enums in FStructs

**URL:** <https://forums.unrealengine.com/t/how-to-properly-insert-engine-default-enums-in-fstructs/436545>\
**Category:** Editor Scripting\
**Tags:** ustruct, ENUM, unreal-engine, UE4, question, CPP\
**Created:** [October 27, 2018, 7:46pm UTC](https://forums.unrealengine.com/t/how-to-properly-insert-engine-default-enums-in-fstructs/436545 "2018-10-27T19:46:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![atanknomore](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@atanknomore](https://forums.unrealengine.com/u/atanknomore)\
**Post date:** [October 27, 2018, 7:46pm UTC](https://forums.unrealengine.com/t/how-to-properly-insert-engine-default-enums-in-fstructs/436545/1 "2018-10-27T19:46:19Z")

</div>

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

> **[Coding Standard](https://docs.unrealengine.com/4.27/en-US/ProductionPipelines/DevelopmentSetup/CodingStandard/)**
>
> 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?

---

<div class="post-metadata">

**Author:** ![Brian\_Johnstone](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Brian\_Johnstone](https://forums.unrealengine.com/u/Brian_Johnstone)\
**Post date:** [October 30, 2018, 7:05pm UTC](https://forums.unrealengine.com/t/how-to-properly-insert-engine-default-enums-in-fstructs/436545/2 "2018-10-30T19:05:14Z")

</div>

When compiling this struct in my 4.20 project the exact combination that worked was this:

```
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HitInformation")
TEnumAsByte<ETraceTypeQuery> TraceType;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HitInformation")
TEnumAsByte<EDrawDebugTrace::Type> DrawType;

```

Both those enumerations needed to be declared as TEnumAsByte but EDrawDebugTrace is declared differently. Make sure you are including Kismet/KismetSystemLibrary.h.

---

<div class="post-metadata">

**Author:** ![atanknomore](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@atanknomore](https://forums.unrealengine.com/u/atanknomore)\
**Post date:** [April 8, 2019, 6:07pm UTC](https://forums.unrealengine.com/t/how-to-properly-insert-engine-default-enums-in-fstructs/436545/3 "2019-04-08T18:07:06Z")

</div>

For anyone that ever stumbles upon this question, the answer is in the following:

Look up at the Enumerator’s declaration (visit there respective Class’ page on Epic’s documentation). If it’s an Enumerator declared below c++ 11, it will have a “namespace” tag on it. That declaration is the following

```
TEnumAsBtye<Enum::Type>

```

If it is an Enum 11, it will have an UEnum declaration on it. That one is simply

```
TEnumAsByte<Enum>
```

---

<div class="post-metadata">

**Author:** ![novikovvlal](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@novikovvlal](https://forums.unrealengine.com/u/novikovvlal)\
**Post date:** [July 23, 2023, 2:06pm UTC](https://forums.unrealengine.com/t/how-to-properly-insert-engine-default-enums-in-fstructs/436545/4 "2023-07-23T14:06:22Z")

</div>

Also you should add PhysicsCore to PublicDependencyModuleNames:

```auto
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG", "EnhancedInput", "PhysicsCore" });

```
