C++ Help

Hello Guys I am fairly new to the whole UE4 C++ syntax as I have stuck with Blueprints for a long time now and decided to take the plunge into how C++ works in Unreal Engine. I have a quick question about FText. I have made a USTRUCT() with a UPROPERTY() of the type FText. What I want to know is how do I set a default value for the FText? Also a larger overall question where and how do I set the default values for every property within a USTRUCT()? Hope that makes sense and someone can help me. I really wanna try and learn. :]

You can set the default value in the constructor.
I don’t work with FText, But I believe that FText has a static method to convert from a FString.

Reading C++ tutorial series may be helpful if you are new to programming in general or C style languages.


FTexts are a bit tricky to make, they need a key.

Here is a thread on how to make them:

The simplest way is to just make an FText off of an FString if you don’t really need all of the FText’s extra functionallity:
FText YourText = FText::FromString(“My string that I need to be text”);

Defaults of struct properties are set in the struct’s constructor. Just add a constructor in your struct and set all of your values’ defaults there.