I’m simply trying to name a component with a variable.
for (int i = 0; i < 5; ++i)
UStaticMeshComponent* tmp = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh" + i));
// or TEXT("Mesh%d", i)
I know this is somehow basic, but I really can’t figure it out. Does anyone know a way to do this?
Thanks in advance!
You could try something like:
CreateDefaultSubobject<UStaticMesh>(*FString("Name" + FString::FromInt(i)));
Also take a look at this link for more information:
Hope this helps
Thanks a lot! I actually tried it like this but without the *
Yea it is because you need to convert the FString to FName.