How to log FText?

I’m having some issues with FText not displaying on my HUD. So, I’m trying to print the contents with UE_LOG. The only thing is nothing prints out. I don’t believe I’m converting my FText to FString or FName correctly.

Here’s what I have currently:

DialogueNodes *temp = dialogues2.Find(id2);
const FString logData = temp->DialogueFragment.ToString();
FName logDataF = FName(*logData);
UE_LOG(LogTemp, Warning, TEXT("DialogueFragment: %s"), *logDataF.ToString());

You don’t need to convert FString to FName to print it with UE_LOG.

Conversion from FText to FString is simple as that:

FText SomeText = FText::FromString("Something");
FString SomeString = SomeText.ToString();
UE_LOG(LogTemp, Log, TEXT("SomeString: %s"), *SomeString);

There’s no magic here afaik. I’d rather guess that the issue is either with the way you fill your FText variable or with the way you’re trying to display it.


Odd, I changed a blueprintable function from return type FName to FText, and it wasn’t getting called. Turns out I had to delete the binding to my HUD in blueprints, and recreate it with all of the same functions.

Good that it works. :stuck_out_tongue:

I think everybody uses this great article on logging