UnityUI and CohtmlView
On this page
If you want to use the UnityUI Canvas
in combination with Prysm for your UI implementation, you can render the CohtmlView
component in a Canvas UI
. Generally, the CohtmlView
component renders the HTML content into a Render Texture
object which you can feed into the RawImage
component and use the Canvas
to render it. You can achieve this by simply adding a new object to the hierarchy of a Canvas
component, or by adding the CohtmlView
component to an existing object. If you place the CohtmlView
component on a game object that does not have a Raw Image
component, the integration code will add such automatically. You can adjust the Rect Transform position of the game object which is the CohtmlView
component in the Canvas
hierarchy to fine-tune the rendering order of the RawImage
texture. Alternatively, you could use multiple Canvas
objects for more complex UI compositions.
RectTransform
dimension of RawImage
covers the entire visible screen of the camera so the UI input behaves correctly.CohtmlView in UnityUI Canvas and BackdropFilter
Currently, Unity3D does not offer a way (e.g. an event or callback) to check that a Canvas
object has been drawn on the screen. This is necessary to ensure the correct rendering of certain features like Backdrop Filter. To achieve the Backdrop Filter affect with CohtmlView
rendered in Canvas
, you can follow the steps below:
- Add a
CohtmlView
to a game object in theCanvas
, which is inScreen Space - Overlay mode
. - Add all UI elements you want to be rendered behind the
CohtmlView
to a secondCanvas
in eitherScreen Space - Camera
orWorld Space
mode.
InWorld
or Screen Space - Camera
mode, Backdrop Filter is not supported.Backdrop Filter
effects provided by Prysm. For all other cases, you can use a single Canvas
and arrange the CohtmlView
in the object hierarchy of the Canvas
.