Random UE snippets (C++)

On this thread I am going to post a bunch of random Unreal Engine snippets I make use of
Make calls easier by redefining them


#define print(text) if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 1.5, FColor::White,text)

Convert Fstring to std::string and vice-versa


std::string cppString = "Sample string";
FString ue4String(cppString.c_str());

FString ue4String2 = "Flowers";
std::string cppString2(TCHAR_TO_UTF8(*ue4String2));

Convert int/float to FString and vice-versa


FString ue4String = "123.021";
int32 intValue = FCString::Atoi(*ue4String);
float floatValue = FCString::Atof(*ue4String);

FString ue4String2 = FString::FromInt(intValue);
FString ue4String3 = FString::SanitizeFloat(intValue)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s