Description

LckMonitor is a component implementing ILckMonitor that represents a display surface (monitor) in the LCK.
It manages a unique monitor ID for registration with the LckCamera and provides a RenderTexture output for connected LckCamera instances.
Applications can subscribe to the OnRenderTextureSet event to receive updates whenever a new RenderTexture is assigned.

Usage

  • Add an LckMonitor component to a GameObject to represent a display target.
  • The monitor will automatically register itself with the LCK system at runtime.
  • Subscribe to OnRenderTextureSet to update UI or 3D objects with the capture output.

Example

using Liv.Lck;
using UnityEngine;

public class MonitorExample : MonoBehaviour
{
    [SerializeField] private Renderer _screenRenderer;
    [SerializeField] private LckMonitor _lckMonitor;

    private void OnEnable()
    {
        _lckMonitor.OnRenderTextureSet += HandleRenderTextureSet;
    }

    private void OnDisable()
    {
        _lckMonitor.OnRenderTextureSet -= HandleRenderTextureSet;
    }

    private void HandleRenderTextureSet(RenderTexture rt)
    {
        // Apply the LCK render texture to a material on a screen mesh
        _screenRenderer.material.mainTexture = rt;
    }
}

References

Fields

FieldTypeDescription
_monitorIdstringUnique identifier for this monitor instance.

Properties

PropertyTypeDescription
MonitorIdstringThe unique identifier for this monitor.

Events

EventTypeDescription
OnRenderTextureSetLckMonitorRenderTextureSetDelegate(RenderTexture renderTexture)Invoked whenever a new RenderTexture is assigned to this monitor.

Methods

MethodReturnsDescription
SetRenderTexture(RenderTexture)voidAssigns a new RenderTexture to the monitor and triggers the event.