using UnityEngine; using RenderHeads.Media.AVProDeckLink; namespace CDFX.AVProDeckLink { [ExecuteInEditMode] public class DecklinkOutputController : MonoBehaviour { public DeckLinkOutput DeckLinkOutput; public Material TargetMaterial; private void Awake() { Debug.Assert(DeckLinkOutput != null, "DecklinkOutputController.DeckLinkOutput needs to be set"); Debug.Assert(DeckLinkOutput._camera != null, "DecklinkOutputController.DeckLinkOutput.Camera needs to be set"); } private void Update() { if (DeckLinkOutput == null) { Debug.LogWarning($"DecklinkOutputController.DeckLinkOutput needs to be assigned"); return; } if (DeckLinkOutput._camera == null) { Debug.LogWarning($"DecklinkOutputController.DeckLinkOutput.Camera needs to be assigned"); return; } if (TargetMaterial != null && TargetMaterial.mainTexture != DeckLinkOutput._camera.targetTexture) { TargetMaterial.mainTexture = DeckLinkOutput._camera.targetTexture; } } } }