tModLoader v2024.11
A mod to make and play Terraria mods
|
By default, string fields will provide the user with a text input field. Use this attribute to restrict strings to a selection of options. This approach is not recommended due to feature deficiencies. It is recommended to use an enum
instead of a string
for this type of option selection. By using an enum
instead of a string
paired with OptionStringsAttribute, localization is possible and automatic. It is also easier to work with enum values and less prone to errors caused by typos. If you want to migrate from a string option entry to an enum in an update to a released mod, you should use the EnumMemberAttribute on the enum fields corresponding to existing string options that had spaces in them previously to support correctly loading the existing config choices of your users when they update the mod:
More...
Inherits Attribute.
Public Member Functions | |
OptionStringsAttribute (string[] optionLabels) | |
Properties | |
string[] | OptionLabels [get, set] |
By default, string fields will provide the user with a text input field. Use this attribute to restrict strings to a selection of options.
This approach is not recommended due to feature deficiencies. It is recommended to use an enum
instead of a string
for this type of option selection. By using an enum
instead of a string
paired with OptionStringsAttribute, localization is possible and automatic. It is also easier to work with enum values and less prone to errors caused by typos.
If you want to migrate from a string option entry to an enum in an update to a released mod, you should use the EnumMemberAttribute on the enum fields corresponding to existing string options that had spaces in them previously to support correctly loading the existing config choices of your users when they update the mod:
[EnumMember(Value = "Left Aligned")] LeftAligned,