Inherited from UComponentDecorator
Related Classes
- UComponentDecorator
- URetainerLayer
- SRetainerWidget
SUMMARY #
Allows you to optimize the layout component if needed and can be used to add visual effects.
WHEN TO USE IT? #
The retainer is used to apply a visual effect to the layout component. It can be used for optimization, but it’s better to use the retainer widget of the touch interface, which will apply global optimization. Use it primarily to apply a visual effect.
OPTIMIZATIONS #
The optimization comes from how the retainer widget works. You can define when the decorators should be rendered. Every frame, every two frames, when an invalidation has been requested, etc.
Render On Phase
This allows both frequency and phase to be controlled so that the UI can actually render less often than the frequency of the main game render.
Phase
If the Phase is 0, and the Phase Count is 1, the widget will be drawn fresh every frame. If the Phase were 0, and the Phase Count were 2, this retainer would draw a fresh frame every other frame. So in a 60Hz game, the UI would render at 30Hz.
Phase Count
The Phase Count controls how many phases are possible know what to modulus the current frame count by to determine if this is the current frame to draw the widget on.
Render On Invalidation
Unreal Engine has an invalidation system that optimizes rendering time. Essentially, if a widget hasn’t changed, it doesn’t need to be redrawn. Invalidation tells the engine that the widget should be redrawn with new information, such as changes in position, size, texture, background (scene), etc. You can force invalidation to update the widget’s rendering.
If the Render on Invalidation option is enabled, then the retainer widget will be updated on each invalidation.
EFFECTS #
The layout component encapsulates the overlay, that contain decorator, in a retainer widget. This widget allows for optimization of the rendering and, at the same time, effects using a material.
To add an effect to the layout component, you must use a material with the User Interface domain type and choose the blend mode. Except in very specific cases, you will need a blend mode that supports transparency, such as Masking, Translucent, Additive, etc. Then you will need to add a texture sample with the name defined in your touch interface settings.
Technically, what happens? The retainer widget renders children widgets to a render target first before later rendering that render target to the screen. This allow materials to be applied to the render target after drawing the widgets to apply a simple post process.
