It might be the case of a tutorial / docs never existing in the first place… Who knows.
The Widget:
You can do anything you need inside but it must be wrapped in a Retainer Box
which can output to a render target.
– we will use the Retain Render flag to switch between 3d and 2d screens
– if you do not need the 3d computer screen animated, untick Render on Phase
– if you want it animated, enable Render on Phase
and use Phase Count
to control the update frequency. 10 means every 10th frame; it’s for optimisation
– the 2d screen-space rendering is unaffected by this
– Texture Parameter
, here called Param
, is needed to update the texture
- widget graph:
- we create a dynamic material instance and assign it to the retainer
- the button’s onClicked closes this widget by disabling mouse interaction with any children of the canvas
- do note this widget never gets
Hidden
orCollapsed
, it needs to be there for the 3d computer screen to render it - especially if you want the widget animated. That’s why weSet Visiblity
rather than remove it from the viewport / container. If you remove it, there’s nothing for the render target to latch onto. It’s the Retainer’s job to eitherRetain Rendering
or let go off it so we can have the 2d screen-space version to play with.
The Material is not exciting:
The Monitor actor:
- the plane serves as the screen while the sphere demonstrates this works for any surface
- we create the widget whose canvas is Not Hit-Testable (All) by default and add it to viewport (it will not show because of the retainer), we grab the instance dynamic material from the widget (MID Screen) and assign it to the plane (and to the sphere, to show off)
- clicking the actor flips the retainer rendering mode, we set the canvas to be NH-T (Self) only - other elements placed there can now be interacted with
Project:
Not sure if this kind of interaction is possible with a widget component. It should but probably is not for reasons I don’t undertand. If there’s a method that can utilise CanvasRenderTarget2d, someone please let me know.