UDN
Search public documentation:

UnrealScriptMetadata
日本語訳
中国翻译
한국어

Interested in the Unreal Engine?
Visit the Unreal Technology site.

Looking for jobs and company info?
Check out the Epic games site.

Questions about support via UDN?
Contact the UDN Staff

UE3 Home > UnrealScript > UnrealScript Language Reference > UnrealScript Metadata

UnrealScript Metadata


Overview


Variables can also have additional information in the form of metadata specified on a per-variable basis to be used by the engine or editor to provide extended functionality. Metadata can be used to specify a display name, tooltip, and min and max values among other things.

Specifying Metadata


Arbitrary metadata can be linked to a property in UnrealScript as follows:

For a variable:

var float MyVar<TAG=VALUE>

For an enum:

enum EMyEnum
{
   EME_ValA<TAG=VALUE>,
   EME_ValB<TAG=VALUE>,
};

Using Multiple MetaData Specifications

You can use multiple metadata specifications for the same property by separating them by a | character.

For example:

var()   LinearColor    DrawColor<DisplayName=Draw Color|EditCondition=bOverrideDrawColor>;

Available MetaData Specifications


Here are the currently supported metadata tags and what they do:

ToolTip=TEXT_STRING
Makes TEXT_STRING appear as the tooltip when the mouse is placed over the corresponding property in an editor property window.
NOTE: Support has been added so that /** VALUE */ comments are automatically translated into ToolTip metadata by the script compiler.
DisplayName=TEXT_STRING
Makes a property’s name appear as TEXT_STRING in the editor property window instead of its actual name.

Example:
   Var() bool bEnableSpawning<DisplayName=Spawning Enabled>;
   

WARNING: The use of DisplayName in enums will cause problems if you modify UPropertyInputCombo to sort enums in editor combo boxes.
ClampMin/ClampMax=FLOAT_VALUE
These allow you to clamp the value of the property. If only ClampMin or ClampMax are specified without the other, the property will use the standard spinner control, but will be clamped appropriately. If both are specified together, the property will use a slider/edit box control instead which is clamped appropriately. See Clamping for additional details.
UIMin/UIMax=FLOAT_VALUE
These can be used in conjunction with ClampMin/ClampMax to specify the range of the slider bar control. If either UIMin or UIMax is not specified, the corresponding Clamp* metadata will be used in its place. This only affects the slider bar; the edit box portion of the control will only respect the Clamp* values. See Clamping for additional details.
ArrayClamp=ArrayProeprtyName
This allows you to clamp the value of an Int property to the valid domain of an array property. This means if the specified array has 4 items in it, the Int property will be clamped between 0 and 3. This is useful for properties that specify an index into an array preventing the designer or artist from ever setting a value that would cause an invalid memory access. See Clamping for additional details.
EditCondition=ConditionalPropertyName
This allows you to make the editability status of an editor property be enabled or disabled based on the value of another (Boolean) property. For example, you could have the following setup in the MyPackage.MyClass UnrealScript class:
   /** Enable or disable spawning */
   Var() bool bEnableSpawning;

   /** Set the rate at which AIs are spawned. Has no effect unless bEnableSpawning = TRUE */
   Var() float RespawnsPerSecond<EditCondition=bEnableSpawning>;
   

And then RespawnsPerSecond would be greyed-out in the editor whenever bEnableSpawning is FALSE. This helps make things less confusing for designers.

Important: This metadata setting requires that the controlled variable (RespawnsPerSecond) utilize a custom property item binding (WxCustomPropertyItem_ConditionalItem).

In order to enable this, you need to hook it up in [Game]Editor.ini, as follows:
   [UnrealEd.CustomPropertyItemBindings]
   CustomPropertyClasses=(PropertyPathName=" MyPackage.MyClass: RespawnsPerSecond ",PropertyItemClassName="WxCustomPropertyItem_ConditionalItem")
   
MultilineWithMaxRows=INT_VALUE
This allows you to create a String property that uses a multiline textbox in the Property Window with the number of rows specified. The textbox will begin as a single line and grow to the number of rows specified as =INT_VALUE as text is entered. Once it reaches the maximum number of rows, the textbox will begin to scroll.
bShowOnlyWhenTrue=PropertyName
This allows you to control the visibility of the proeprty in the Property Window based on the value of a property filter set up in the [Game]EditorUserSettings.ini file under the [UnrealEd.PropertyFilters] section.
FriendlyName=TEXT_STRING
Used by the UI Editor?.
AllowAbstract
If present on a Class property, editor drop-down boxes for editing that property will include abstract classes. If not present, they will only contain concrete classes. There is no need to specify a value such as True or False in this metadata specification.
AutoComment=BOOLEAN_VALUE
When added to a property of a Kismet Sequence Action, the property and its current value will automatically appear as a comment above that action. To see this in action place a new "Gate" sequence action in a script. In this class both bOpen and AutoCloseCount use this metadata option.