Skip to main content

Description

LckMonitor is a Unity MonoBehaviour implementing ILckMonitor that acts as a display surface for LCK camera output. It auto-registers with the LCK system on enable, provides a RenderTexture output from connected LckCamera instances, and raises an event whenever a new texture is assigned — so you can pipe the capture preview onto any in-game screen, UI element, or 3D mesh.

Usage

Use LckMonitor when you need to show the camera preview in your scene. Add it to a GameObject, then subscribe to OnRenderTextureSet to apply the texture wherever you need it.
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.

See Also

  • LckCamera — Camera component that outputs to monitors
  • ILckMonitor — Interface that LckMonitor implements
  • LckMediator — Static registry where monitors are auto-registered