using UnityEngine; using UnityEngine.Rendering.Universal; using UnityEngine.UI; public class OverlayToRenderTexture : MonoBehaviour { public RenderTexture targetRenderTexture; private void Start() { // 获取相机组件 Camera camera = GetComponent(); // 设置渲染目标为RenderTexture camera.targetTexture = targetRenderTexture; } }