|
ArticyXImporter
ArticyXImporter for Unreal Engine
|
In Unreal Engine, the ArticyImporter plugin automatically processes text through an advanced text processing system known as Text Extensions, similar to the Unity version. This system allows you to use global variables, object properties, and other dynamic values inside text fields. You can insert special tokens into strings, which are then resolved at runtime to produce final, localized output. This guide covers how to use text extensions, including token formatting, variable substitution, and advanced use cases.
To utilize the text extension system, you add tokens inside your strings. A token is a placeholder that represents dynamic content, such as variables or object properties. The syntax is the same whether you're writing text directly in articy:draft or in Unreal Engine.
In this example, [Session.PlayerName] is a token that will be resolved at runtime to the value of the PlayerName global variable.
A token is surrounded by brackets [ ] and typically follows this form:
Text extensions in Unreal allow you to pull information from various sources. These sources include global variables, object properties, templates, and more.
You can reference global variables directly in your text by specifying their namespace and name.
Example:
This will dynamically display the player's name and the amount of gold they currently have.
You can also access properties of objects and templates by using their ID or technical name.
Examples:
Displays the display name of the character Chr_Manfred.
Accesses a property from the Character template associated with Chr_Manfred.
When working with multiple instances of the same object, you can specify an instance ID to target a particular instance.
Example:
This targets the 15th instance of the Guard object and retrieves the HP property.
Tokens can be formatted to modify the appearance of the resolved value. This is especially useful for numbers and dates. Formatting is applied after the source using a colon : followed by a format string, similar to C# string formatting rules.
Examples:
Depending on the context of the text, you can access the current object ($Self) or the speaker in a dialogue fragment ($Speaker).
Example:
In this example, the token references the speaker's gold count in the inventory.
You can access properties across multiple related objects, access strips (lists of references), and even nest tokens within other tokens.
Here, Companion is a reference slot containing another character, and the token retrieves that companion's HP value.
You can conditionally modify the output of your text using built-in methods like if and not.
This checks if the player is wearing a police uniform. If they are, the text adds ", Officer"; otherwise, it adds nothing.
The not method works similarly but inverts the conditions.
Script properties in Articy can also be accessed and executed within tokens.
This executes the script and returns the result. For condition scripts, this will return a boolean.
While text extensions work automatically for Articy object properties, you can also manually resolve tokens in your own strings using the ResolveText function. This is useful when building dynamic text outside of Articy-generated objects.
You can create your own custom methods to use inside tokens. Custom methods are registered with the text extension system and can be used like built-in methods.
The Text Extensions system in Unreal's ArticyImporter plugin is a powerful tool for embedding dynamic content into text fields. By using tokens, formatting options, and custom methods, you can create rich, dynamic, and localized text content that adapts to the game's state. Whether you're pulling from global variables, object properties, or even scripts, this system provides flexibility and ease of use in your narrative design.