Live Views

Overview

The Live Views feature gives you a way to render a dynamically-changing texture from the engine inside your UI. This allows you to capture live scenes from your engine, such as moving character models or low-resolution views of the map and show them inside your UI, resulting in easy-to-do character customization screens, minimaps, or other difficult to achieve menu components. This is most commonly implemented by dynamically populating a texture with the feed from a camera placed in the game world and configuring your HTML page to display the contents of the texture.

How To Use

  1. Add a second camera to the scene.

  2. Add a CohtmlLiveView component on the second camera GameObject.

  3. Now set up the CohtmlLiveView component.

    1. Fill in the identifier you want to use for your texture inside the Name field. For this example, we will call it MyLiveView.
    2. Adjust the width and height if required.
    3. (Optional) Create a RenderTexture and attach it to the TextureTarget property.
  4. Create an HTML document. For this example, we will call it liveView.html. Add a reference to the texture inside your UI.

    <img src="coui://MyLiveView">
    
  5. Go to a CohtmlView and fill the URL field with the LiveView.html path.

Tips and best practices

You can check the Live Views sample included in your Prysm plugin for the Unity3D package.

If the CohtmlLiveView’s Target Camera field is empty when playing the scene, Prysm will search the camera component on the attached GameObject.

You can change CohtmlLiveView’s Target Camera renderer during Play mode. It will reuse the same render texture.

You can use an existing RenderTexture asset by assigning it to the Target Texture field of your CohtmlLiveView.

Use CohtmlLiveView’s Width and Height fields to resize the render texture. These two fields don’t work on Play mode.

After the CohtmlLiveView render texture is registered inside the Prysm resource handler you cannot change it or recreate it.