Gurulis99
(Gurulis99)
August 3, 2020, 2:20pm
1
Hello guys,
i have some trouble in replacing the actor’s name. I tried to do this:
RandomActor ->SetActorLabel(FString(“ThisIsActor%d”,i));
I want to name this: ThisIsActor444 (i = 444) but it doesnt work… Instead, it ruins up the name (eg “ThisIsAc”)
Any ideas??
FString does not have the ability to directly append variables like you’re code is trying to do.
The “i” in your case would be interpreted as “extraSlack” property to the FString.
You could use FString::Printf however, like so:
FString::Printf(TEXT("ThisIsActor%d"), i)
Gurulis99
(Gurulis99)
August 4, 2020, 6:37am
3
This worked! Thank you!! Also, this is working:
SetActorLabel(Fstring("TheActor") + Fstring::FromInt(i));