ANY_PACKAGE is deprecated in 5.1
After some testing, here is an alternate solution that is easier to use and doesn’t use the deprecated macro.
//////////////////////////////////////////////////////////////////////////
// Enum To String
// Usage Example:
// FString EnumString = EnumToString( EnumValue );
//////////////////////////////////////////////////////////////////////////
template< typename T >
FString EnumToString( T EnumValue )
{
static_assert( TIsUEnumClass< T >::Value, "'T' template parameter to EnumToString must be a valid UEnum" );
return StaticEnum< T >()->GetNameStringByValue( ( int64 ) EnumValue );
}
Edit: I was erroneously using GetNameStringByIndex here, but I have corrected it here. This will work as stated in all cases now.