From e933e440aff65d8e069d82502ecf9638dad588cd Mon Sep 17 00:00:00 2001 From: camille-avatarmedical Date: Wed, 7 Aug 2024 10:17:44 +0200 Subject: [PATCH] Manage active render texture to avoid changing it when recording the screen. --- com.unity.renderstreaming/Runtime/Scripts/VideoStreamSender.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/com.unity.renderstreaming/Runtime/Scripts/VideoStreamSender.cs b/com.unity.renderstreaming/Runtime/Scripts/VideoStreamSender.cs index e9c75320c..4352bed6a 100644 --- a/com.unity.renderstreaming/Runtime/Scripts/VideoStreamSender.cs +++ b/com.unity.renderstreaming/Runtime/Scripts/VideoStreamSender.cs @@ -708,8 +708,10 @@ IEnumerator RecordScreenFrame() while (true) { yield return new WaitForEndOfFrame(); + var rt = RenderTexture.active; ScreenCapture.CaptureScreenshotIntoRenderTexture(m_screenTexture); Graphics.ConvertTexture(m_screenTexture, m_screenCopyTexture); + RenderTexture.active = rt; } }