Unity URP中使用UI相机

public class RTCamera : MonoBehaviour
{
    public RTCameraType CameraType;    

    [HideInInspector] public Camera Camera;

    private void Awake()
    {
        Camera = GetComponent<Camera>();
            
        // UI相机叠加到当前相机之上
        Camera.GetUniversalAdditionalCameraData().cameraStack.Add(UIManager.Instance.UICamera);

        
    }

    private void OnDestroy()
    {
        Camera.GetUniversalAdditionalCameraData().cameraStack.Remove(UIManager.Instance.UICamera);
        
    }

}

Unity URP中使用UI相机

上一篇:The assembly for System.Buffers could not be loaded;无法加载System.Buffers的程序集


下一篇:Docker多阶段构建实战(multi-stage builds)