using a UENUM to safely manage and check an object's movement direction

I’m not certain which is the cause, but:

Your enum name is not really following convention. The enum type name should have the ‘E’ prefix, so:


enum class EMoveDirection: uint8

Then your variable name would become just ‘MoveDirection’.

You have EnumMoveDirection& in your declaration, and EnumMoveDirection (without the &) in your definition.

You’d be better off just returning the enum from your function rather than passing it in by reference.

Failing that, since it’s a UFUNCTION you may need to wrap your parameter/return type as TEnumAsByte< EMoveDirection >, but I wouldn’t have thought that was necessary.