FName + FName Error

FName LEV_Mode = "_PLAY_";
int32 LEV_Current = 10;

FName LevelJump = "LEV_" + LEV_Current; // OK

FName LevelJump = "LEV" + LEV_Mode + LEV_Current // ERROR! 

UGameplayStatics::OpenLevel(GetWorld(), LevelJump);

How to join 2 FNames without converting it all into strings?

This post should help you

The only workaround for joining FNames was to convert to a FString, do my concatenations, then convert back again.

Dumb. Me or FName?

In general, FNames are usually something you aren’t stringing together dynamically. What a re you using this dynamically built FName for?

just to get names dynamically of level to load

LEV_001, LEV_002, LEV_003 …
The built in UE static uses an FName for the level reference…so I built my concatenate function using FNames…well bad idea!

1 Like

I don’t think you want to be using or operating on FNames until you absolutely need them.