Use C++ String in Blueprint

Hi All,Is there a way I can make a string in C++ and attach this to a string variable and then call that variable in a blueprint, which would then allow me to output this to the screen ?

I declared the String variable as below

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = MultiThreading)
		FString OutputText;

Then I try and add the information to it as below

if (isPrime) FString OutputText = FString(TEXT("Prime Number: " + FString::FromInt(i)));

I followed a tutorial found here http://orfeasel.com/implementing-multithreading-in-ue4/ and he outputs via the output log, which is not something I want to do. (However it did work)

He does it like this (as a comparision)

if (isPrime) GLog->Log("Prime number #" + FString::FromInt(i) + ": " + FString::FromInt(i));

I then try and call it in the blueprint to allow me to set the print string text (Only the OutputText and Print String are tied to this issue)

I’m doing something wrong, or totally failing at understanding what each part is doing as when I test it nothing appears on screen.

If you require any further code I’d be happy to add this for you, all I have attached is the code and blueprint which actually corresponds which this issue (All other code is working fine).

Any help would be greatly appreciated

Thanks in advance

Hello,

you are shadowing your class member OutputText:

if (isPrime) 
{
FString OutputText = FString(TEXT("Prime Number: " + FString::FromInt(i)));
// <- you are creating a local variable here. Remove FString in front of OutputText to write to the class member
}

that’s right, basically instead of setting the text on your .h parameter, you’re creating a new one inside your cpp function.
you need to OutputText = new text; not Declare again as FString OutputText = initial text;

You’re never setting the value of your original text.