Having a quick reference for those common types would be very helpful.
Summarization of how those types differ - when to use which? This would be more about the Unreal Engine itself but I believe that a short explanation will benefit those trying NimForUE that aren't Unreal Engine experts.
How to create each FName, FString and FText in NimForUE - is there more than one way?
Converting between those types
Type-specific functionality? Are there any commonly used functions for each type?
Notes
To create FName from string use makeFName(string) or the n raw string: n"Hello world"
AI generated overly-lengthy explanation
[!CAUTION]
This needs to be verified!
FString
Use cases:
General-purpose mutable string type
Used for runtime-generated text that doesn't need localization
Temporary string operations and manipulations
Memory/Performance:
Dynamically allocated
Can be more memory-intensive for large strings
Slower for comparisons and lookups compared to FName
Special functionality:
Supports standard string operations (concatenation, substring, etc.)
Can be easily converted to and from standard Nim strings
In NimForUE:
let myString: FString = "Hello, World!"
FName
Use cases:
Immutable identifiers for objects, functions, properties
Optimized for fast comparisons and lookups
Used in places where you need a string-like type but don't need to modify it
Memory/Performance:
Stored in a global name table, only one copy of each unique name exists
Very fast comparisons (just comparing integers)
More memory-efficient for repeated uses of the same string
Special functionality:
Case-insensitive comparisons by default
Faster to work with in many engine systems
In NimForUE:
let myName: FName = n"MyIdentifier" # Note the 'n' prefix
FText
Use cases:
Localized text that needs to be displayed to the user
Text that may change based on plurality, gender, or other grammatical rules
Memory/Performance:
Can be more memory-intensive than FString or FName
Slightly slower performance due to localization features
Special functionality:
Built-in support for localization
Supports complex text formatting rules
Can be easily updated when the game's language changes
In NimForUE:
let myText: FText = "Hello, World!".toText()
Special NimForUE considerations
In NimForUE, you'll often use these types when interacting with Unreal Engine's systems. Remember that NimForUE provides some convenience methods for working with these types, like the n prefix for creating FNames and the toText() method for creating FTexts.
Also, when defining properties in your NimForUE classes, you'll use these types directly:
Having a quick reference for those common types would be very helpful.
Notes
FName
from string usemakeFName(string)
or then
raw string:n"Hello world"
AI generated overly-lengthy explanation
FString
Use cases:
Memory/Performance:
FName
Special functionality:
In NimForUE:
FName
Use cases:
Memory/Performance:
Special functionality:
In NimForUE:
FText
Use cases:
Memory/Performance:
Special functionality:
In NimForUE:
Special NimForUE considerations
In NimForUE, you'll often use these types when interacting with Unreal Engine's systems. Remember that NimForUE provides some convenience methods for working with these types, like the
n
prefix for creating FNames and thetoText()
method for creatingFTexts
.Also, when defining properties in your NimForUE classes, you'll use these types directly: