String Enums can easily be extended to a large number of entries while traditional enums are bound to 255 entries
Internally to the engine String Enums are structs that contain an Name type variable, always check your variable types if running into compatibility issues.
Deprecated Enum |
Refactored String Enum |
---|---|
E_WeaponComboType |
EWeaponComboType |
Add a new variable and assign it the appropriate String Enum type, these appear as
structs
with an
E
prefix
Currently new types can only be defined in code, we plan to extend this in the future to allow modders to declare their own String Enum types.
Compile the blueprint and locate the variable, notice it has a drop down menu.
The drop down list is populated by concatenating values from all
String Enum Data Providers
of the associated type. We will go through how to add new entries to this list later in this documentation.
To access the data either
split
or
break
the variable, this will return the associated
Name
value
In order to add new String Enum entries, you need to create a blueprint class of one of two types:
StringEnumFixedListDataprovider
StringEnumDataTableDataprovider
Fixed Lists Data Providers contain a static list of values, assign the
Target Enum
Now, you can populate the Fixed List with values as in this example.
Create a new table with your entries.
Hint: You can use any table, and only row names will be used to extend your string enum.
Data Table Data Providers generate their values from an associated Data Table, we again need to assign the
Target Enum
type here to tell the engine which enums to add entries to.
Assign
Table Ref
, the tables
Row Name
will be used to generate values
Now you can assign values to the Data Table
Once all files are compiled and saved we can review our new string enums by check the variable we made previously.