How to log the `EnumArray` to Screen? C++

I know to print the UEnum Array to console log output window as string.

//this will print the whole array elements in console output.

UE_LOG(LogTemp, Warning, TEXT("The Elements in Array: %s"), *UEnum::GetValueAsString(EnumArrayRef));

//Printing simple message to screen.

GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("My Message"));

But how to print EnumArrayRef to the screen?
I searched many forums, posts , google and not find the solution.
kindly guide me thank you )

this is not as complicated as you think, if you don’t found the answer it mean nobody asked for this anywhere.

to print on the screen do it that way:

GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Orange, FString::Printf(TEXT("The Elements in Array: %s"), *UEnum::GetValueAsString(Array)));

hope it helps!
cheers!

2 Likes

Thank you very much helping in my studies of ue4 C++ , really appreciated :slight_smile:

1 Like

please tell me if is possible to make macro for this and how?

in myMacros.h

#define LogEnumArray(Format, ...) if(GEngine){GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Yellow, FString::Printf(TEXT(Format), ##__VA_ARGS__), false);}

include the header anywhere you want to call this macro

LogEnumArray("%s", *UEnum::GetValueAsString(MyEnumArray));

hope it helps!
cheers!

2 Likes

thank you very very much :slight_smile: