FName
Class¶
An immutable case-insensitive but case-preserving string type, that is widely used throughout the engine. It is used for asset names, variables and parameters, etc. When shown, it is often passed through FName::NameToDisplayString
, which converts a string like DrawScale3D
to Draw Scale 3D
. However, it is not insensitive to spaces during comparison.
FName(TEXT("confirm")) == FName(TEXT("Confirm")) // true
FName(TEXT("DrawScale3D")) == FName(TEXT("Draw Scale 3D")) // false
FName
s are indexed in a global table, and the engine will use their unique identifier to compare them, making them faster to compare than FString
s. The two types can be easily converted to one another:
TestHUDString = TestHUDName.ToString();
TestHUDName = FName(*TestHUDString);