As Unreal Engine continually evolves, we often release ‘Experimental’ and ‘Early Access’ features for developers to explore. As these names imply, these features are not yet production ready, but provide an opportunity to experience – and contribute to…
Today’s architectural designers are turning to bold new approaches for crafting compelling design visualizations. With clients wanting more interactivity and flexible options for design review, it makes sense that real-time solutions are becoming the f…
Autodesk University is back for another exciting year! Planning on attending? We’d love to have you join us to experience the future of interactive design with the latest real-time technology.
AU 2018 is from November 13 to 15 at the Venetian Hotel i…
The Infinity Film Festival will take place throughout multiple iconic venues in Beverly Hills from Thursday, November 1 to Sunday, November 4, with over 75 hours of screenings and 100 speakers.
On November 1-2, Epic will host the IFF Tech Lab, whic…
Are you ready to join other architects, designers, engineers, producers, and artists already using Unreal Engine to revolutionize the professional creative landscape? Don’t miss out on this value-packed learning and networking experience!
On October 3, 2018, nearly 300 professionals from the architecture, engineering and construction industries gathered at the Royal Institute of British Architects (RIBA) in London to showcase and discuss real-time technology, and look at some of the exc…
When working with game UI, the typical UMG Text block offers a healthy variety of style options and customizations. However, many developers have found the need for more flexible text that supports markup for things like style changes, inline images, hyperlinks, and much more. Much of this has already been possible with the experimental Rich Text Block widget through code.
For the 4.20 release, the widget was made available to UMG and in the process it’s workflow polished to be more flexible and extensible than before. As part of this polishing phase, rather than attempt to support every possible customization a developer may need, we’ve set the Rich Text Block up to accept Decorator classes, enabling you to define the markup behavior you need for your project. You’ll find that a single Decorator class has been provided as an example for setting up your own decorators with RichTextBlockImageDecorator.cpp.
In this blog post, I’ll go over both how to work with the new Rich Text Block widget in UMG as a UI designer and as a programmer. I’ll explain how you can extend it with additional functionality using Decorator classes. Before diving right into adding your own customizations, it may be helpful to familiarize yourself with the newly exposed Rich Text Block functionality in UMG. The Rich Text Block widget enables you to customize the contents of your block using text styles and decorators using Data Table Assets or your own Decorator classes.
The Data Table Asset you create is used to store any type of data based on any user-defined struct. When you create a Data Table, you’ll notice there are two provided: Text Style Row and Image Row. Text Style Row structs are part of the built-in stylings provided with Rich Text Block that enables you to define the font type, whether it is outlined, what type of color and size it should be, and much more. The Image Row is part of the provided RichTextBlockImageDecorator example class that enables you to specify any Decorator classes in the Rich Text Block widget. With it, like the Text Style Row struct, you’ll be able to define properties for in-line images such as size scaling, tint, alignment, and more.
The RichTextBlockImageDecorator class example provides you with a starting point to create your own markup text that can be replaced with whatever Slate content you want, including things such as images, hyperlinks, and even entire widgets! Data Tables can hold any type of data and be set up in the Editor through a Data Table Asset.
First of all, we’ll need to create a new Widget Blueprint and use the Palette to drag a Rich Text Block onto the Canvas. With the Rich Text Block selected, use the Details panel to locate the Text Styles Set. This asset assignment slot lets us pass in a data table of styles that defines both our Text Style and any number of additional styles we may wish to use. You can go ahead and create a new Data Table by selecting this assignment dropdown and selecting Data Table or by using the Content Browser and selecting Add New > Miscellaneous > Data Table.
When you create a Data Table, you can go ahead and create it right from inside the Details panel in UMG. Choose Rich Text Style Row for the row struct from the Pick Structure window and dropdown.
Open up your new Data Table by double-clicking it in the Details panel in UMG or from the Content Browser. In the Data Table Editor, we’ll start by creating a new row name “Default.” This row represents our text in its default state and will automatically be used by the Rich Text Block for any text where it’s not been explicitly set to a different style.
Explore the different options under your newly created Default row and set the baseline style you want for the type of font, size, typeface, and more. Once you’re happy with that, go ahead and add some additional styles by clicking the plus (+) button to add a new row and then enter a name in the Row Name text box.
Back in the Widget Blueprint with your Data Table asset assigned, go ahead and add some text to the Text section of the Rich Text Block through the Details panel.
In the UMG toolbar, you may need to click the Compile button to display text in the Rich Text Block widget.
The text here is using the Default row we set up. To apply another one of your styles created in your Data Table Asset, use the following format to apply style to the wrapped text:
In this example, we wrapped the text we want to inherit the style in our tag that is used in our Data Table Asset for this row using Rich. In doing so, the text now inherits the properties we set, in this case, orange text with a black outline.
Keep in mind that this style tag does not require any prefix or postfix, such as RichText.* to work, and it is not case-sensitive.
At this point, we’re now able to apply different styles to text within the Rich Text Block but what if we wanted to inject something other text? We can use Decorators to do that by setting up our own markup tags. These markup tags let us use Slate to render anything we want seamlessly within our text.
To get you started, we’ve included an example RichTextBlockImageDecorator class that can be used to add an image to a Rich Text Block using a Decorator class. Like the built-in stylings of the Rich Text Style Row, the Rich Image Row struct defines all the images we would want to support with in line text.
Now, we’ll continue by extending the provided RichTextBlockImageDecorator class so that we can point our subclass at the Rich Image Row Data Table that we just created. The simplest way to do this is to create a new Blueprint class, choose the RichTextBlockImageDecorator class that is provided as the parent class, open the Blueprint and assign the Data Table to the Image Set property of the class.
Take note that in 4.20, the image decorator doesn’t appear in the list of parent classes, however, this will be supported in 4.21. For the time being, you can extend it as a C++ class and either assign your data table in the C++ file or add Blueprintable to the UCLASS macro at the top of the header in order to extend your subclass as a Blueprint.
Once your Decorator is set up, add it to your Rich Text Block’s Decorator Classes array and insert images from your table using the following markup:
You may need to hit the Compile button in the toolbar for the changes to display and take effect.
Adding New Decorators
While we do provide the RichTextBlockImageDecorator class as an example, the best part about the Rich Text Block is that you can now define your own custom decorators that leverage the full power of Slate, enabling you to add anything you want in line with your your text. To do this, you’ll need to write two classes: a URichTextBlockDecorator and an FRichTextDecorator. Once these classes are set up, you’ll be able to add your decorator to any Rich Text Block via the DecoratorClasses array in the Rich Text Block widget in UMG. You’ll also be able to use your markup to parse text with your decorators.
URichTextBlockDecorator defines an UObject class that can expose properties to the Editor’s Details panel. At a bare minimum, you’ll need to implement CreateDecorator, which should return a SharedPtr to the FRichTextDecorator instance you’ll create to do all your heavy lifting. You’re welcome to also implement any properties and utility functions here, which will let your designers create subclasses of your Decorator as a Blueprint in order to pass in whatever data they need. You might recall that the RichTextBlockImageDecorator defines a data table property so that we can pass in our table of images. Anything you want to be modified in Blueprint should exist here on the UObject.
FRichTextDecorator is responsible for the actual parsing/substitution of markup tags and requires two functions to be implemented. The first function, Supports, is given the contents of the markup tag via an FTextRunParseResults and simply returns true or false depending on whether the decorator is actually responsible for handling of this tag. Supports will be called for every decorator in your DecoratorClasses array before falling back to just displaying the tag as regular text if we can’t find the decorator to handle it. The second function, CreateDecoratorWidget, is called to actually construct and return the widget by replacing the supported markup tag. You’ll have access to FTextRunInfo if you need any text or metadata in the tag.
In the case of the RichTextBlockImageDecorator class, we define an SRichInlineImage widget and populate it with the correct image from our data table that is passed to the UObject wrapper class before passing it as the return value for the CreatorDecoratorWidget.
Using Rich Text in Your Project
We’ve gone over how to use the Rich Text Block’s built-in features and how to write Decorator classes to add your own functionality. Now, how does this fit into your project’s workflow?
If you find yourself setting up the Decorator Classes array with the same set of decorators every time you make a Rich Text Block, it can be useful to your own subclass of the Rich Text widget with a default set of decorators. If you need even more control, you’ll also notice that SRich Text Block has support for custom parsers and marshallers. You can write your own parsers to change the rules on how markup tags are detected and processed, and a custom marshaller will give you control over how your text is laid out within the widget.
While it may be tempting to start using Rich Text Blocks widgets in place of all your project’s text areas, there is a performance cost associated with parsing the text in search of tags. For anything where performance may be a concern, you’ll want to continue to use regular text blocks wherever the extra features of the Rich Text Block are not needed.
The Rich Text Block widget opens up a plethora of possibilities for applying interesting effects to your project’s text. With it, you’ll be able to apply simple effects like text highlighting and gamepad buttons or more interactive effects like inline buttons and loot links, with decorators letting you add in anything you can imagine!
Visit our documentation for Rich Text Block to dive in and get started using it!
Taking place first at the JW Marriott in downtown Los Angeles on October 18 and then at the beautiful St. James Theater in Montreal on November 14, Dev Days 2018 is an exclusive series of events designed for developers looking to take their pipeline to the next level with Unreal Engine.
First announced in early September, Epic has today revealed the details of what attendees can expect during this year’s event. The below sessions are geared towards game developers currently in production and are designed to help them be as successful as possible in Unreal Engine.
The Dev Days 2018 presentations are:
Session: Unreal Engine Roadmap
Presenter: Nick Penwarden, Director, Engineering, Unreal Engine, Epic Games
We’ll kick off the day with a discussion of the features and developments coming to Unreal Engine.
Session: Overcoming Common Early Challenges in Unreal Engine
Presenter: Zak Parrish, Senior Dev Rel Tech Artist, Epic Games
This practical discussion will present an overview of common issues that arise during a studio’s first six months on a UE4 project, focusing on solutions. Topics will include general best practices, optimization guidelines, and how to avoid common pitfalls of game development.
Session: Introduction to Niagara
Los Angeles – Wyeth Johnson, Lead Technical Artist, Epic Games
Montreal – Alan Willard, Senior Dev Rel Tech Artist, Epic Games
In this Q&A-based session we’ll give an overview of Niagara, our new VFX simulation tool, and the philosophy behind our new VFX paradigms. We’ll talk about the Niagara feature roadmap and our new suite of content examples, and discuss the tool and its uses.
Session: Making the Most of Animation Blueprints
Presenter: Kaye Vassey, Senior Technical Animator, Epic Games
This talk will cover Fortnite’s use of animation Blueprints. We’ll cover the use of Blueprints for gluing together character parts after retargeting, dynamic solutions for low LODs, and faking dynamics in higher LODs with procedural animation techniques.
Session: Adjusting Your Content to Perform on Target Hardware
Presenter: Joe Conley, Support Engineer, Epic Games
When building new content for a given platform, or porting from one platform to another, it’s very common to end up with assets that are too demanding for the target hardware. There are many tools inside of Unreal Engine that can help you align the content you made with what the hardware can actually run. In this session, we’ll compare different methods for asset reduction such as polygon reduction, LODs, merging actors, and resizing textures to see which optimizations are effective in improving performance in which scenarios. We’ll also discuss how to make your game load faster and hitch less through profiling and optimizing asset loading and garbage collection.
Session: What’s New for Animation in UE4
Presenter: Jay Hosfelt, Senior Animator, Epic Games
This talk will provide an overview of the latest animation tools in UE4. Topics include the Live Link and Control Rig plugins, and the Animation Retargeting feature.
Interested in attending? Registration is open via the links below.
Unreal Dev Days 2018 – Los Angeles | Thursday, October 18, 2018 | 10AM – 6PM
Unreal Dev Days 2018 – Montreal | Wednesday, November 14, 2018 | 10AM – 6PM
We hope to see you there!
At the SIGGRAPH 2018 conference, Epic Games presented a series of tech talks on uses of Unreal Engine for media & entertainment. In case you missed them (or just want to revisit your favorites!), several of these fascinating one-hour talks are now avai…