From 250426b2c6709a46ac83af228c621263abf14712 Mon Sep 17 00:00:00 2001 From: KINDNICK <68893236+KINDNICK@users.noreply.github.com> Date: Tue, 2 Dec 2025 20:38:32 +0900 Subject: [PATCH] =?UTF-8?q?Fix=20:=20=EC=B5=9C=EC=A0=81=ED=99=94=20?= =?UTF-8?q?=ED=8C=A8=EC=B9=98=20=EC=A7=84=ED=96=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SpoutOutputScript/RenderStreamOutput.cs | 3 +++ .../Controllers/CameraControlSystem.cs | 15 ++++++++++++--- .../Controllers/CameraController.cs | 2 ++ .../Controllers/EventController.cs | 5 ++++- .../Controllers/ItemController.cs | 2 ++ .../Controllers/SystemController.cs | 7 +++++-- 6 files changed, 28 insertions(+), 6 deletions(-) diff --git a/Assets/Scripts/SpoutOutputScript/RenderStreamOutput.cs b/Assets/Scripts/SpoutOutputScript/RenderStreamOutput.cs index 32ed7885..6d720964 100644 --- a/Assets/Scripts/SpoutOutputScript/RenderStreamOutput.cs +++ b/Assets/Scripts/SpoutOutputScript/RenderStreamOutput.cs @@ -277,6 +277,9 @@ public class RenderStreamOutput : MonoBehaviour private void OnDestroy() { + // m_ScriptablePass 정리 (내부 텍스처 참조 해제) + m_ScriptablePass = null; + if (ShaderCameraTexture != null) { ShaderCameraTexture.Release(); diff --git a/Assets/Scripts/Streamingle/StreamingleControl/Controllers/CameraControlSystem.cs b/Assets/Scripts/Streamingle/StreamingleControl/Controllers/CameraControlSystem.cs index 898a2a2c..0e5acc02 100644 --- a/Assets/Scripts/Streamingle/StreamingleControl/Controllers/CameraControlSystem.cs +++ b/Assets/Scripts/Streamingle/StreamingleControl/Controllers/CameraControlSystem.cs @@ -28,6 +28,7 @@ public class CameraControlSystem : MonoBehaviour private CameraManager cameraManager; private CinemachineCamera currentVirtualCamera; private CameraInfoUI cameraInfoUI; + private GameObject cameraInfoUIGameObject; // UI GameObject 참조 저장 (정리용) // FOV 물리 시스템 변수들 private float fovVelocity = 0f; // 현재 FOV 변화 속도 @@ -71,9 +72,9 @@ public class CameraControlSystem : MonoBehaviour UpdateCurrentCamera(); } - // CameraInfoUI 생성 - GameObject uiGO = new GameObject("CameraInfoUI"); - cameraInfoUI = uiGO.AddComponent(); + // CameraInfoUI 생성 (정리를 위해 참조 저장) + cameraInfoUIGameObject = new GameObject("CameraInfoUI"); + cameraInfoUI = cameraInfoUIGameObject.AddComponent(); // Beautify 컴포넌트 찾기 Debug.Log("[CameraControlSystem] Beautify 초기화 시작"); @@ -106,6 +107,14 @@ public class CameraControlSystem : MonoBehaviour { cameraManager.OnCameraChanged -= OnCameraChanged; } + + // CameraInfoUI GameObject 정리 + if (cameraInfoUIGameObject != null) + { + Destroy(cameraInfoUIGameObject); + cameraInfoUIGameObject = null; + cameraInfoUI = null; + } } private void InitializeRawInput() diff --git a/Assets/Scripts/Streamingle/StreamingleControl/Controllers/CameraController.cs b/Assets/Scripts/Streamingle/StreamingleControl/Controllers/CameraController.cs index 7fb2c3c5..931d0a6d 100644 --- a/Assets/Scripts/Streamingle/StreamingleControl/Controllers/CameraController.cs +++ b/Assets/Scripts/Streamingle/StreamingleControl/Controllers/CameraController.cs @@ -242,6 +242,8 @@ public class CameraManager : MonoBehaviour, IController RawInput.Start(); RawInput.WorkInBackground = true; } + // 중복 구독 방지를 위해 먼저 해제 후 구독 + RawInput.OnKeyDown -= HandleRawKeyDown; RawInput.OnKeyDown += HandleRawKeyDown; } diff --git a/Assets/Scripts/Streamingle/StreamingleControl/Controllers/EventController.cs b/Assets/Scripts/Streamingle/StreamingleControl/Controllers/EventController.cs index d9d6f177..46dc122b 100644 --- a/Assets/Scripts/Streamingle/StreamingleControl/Controllers/EventController.cs +++ b/Assets/Scripts/Streamingle/StreamingleControl/Controllers/EventController.cs @@ -212,8 +212,11 @@ public class EventController : MonoBehaviour, IController if (!RawInput.IsRunning) { RawInput.Start(); - RawInput.OnKeyDown += HandleRawKeyDown; + RawInput.WorkInBackground = true; } + // 중복 구독 방지를 위해 먼저 해제 후 구독 + RawInput.OnKeyDown -= HandleRawKeyDown; + RawInput.OnKeyDown += HandleRawKeyDown; } private void UpdateHotkeyRecording() diff --git a/Assets/Scripts/Streamingle/StreamingleControl/Controllers/ItemController.cs b/Assets/Scripts/Streamingle/StreamingleControl/Controllers/ItemController.cs index 1d54d88f..37af96b1 100644 --- a/Assets/Scripts/Streamingle/StreamingleControl/Controllers/ItemController.cs +++ b/Assets/Scripts/Streamingle/StreamingleControl/Controllers/ItemController.cs @@ -239,6 +239,8 @@ public class ItemController : MonoBehaviour, IController RawInput.Start(); RawInput.WorkInBackground = true; } + // 중복 구독 방지를 위해 먼저 해제 후 구독 + RawInput.OnKeyDown -= HandleRawKeyDown; RawInput.OnKeyDown += HandleRawKeyDown; } #endregion diff --git a/Assets/Scripts/Streamingle/StreamingleControl/Controllers/SystemController.cs b/Assets/Scripts/Streamingle/StreamingleControl/Controllers/SystemController.cs index 82ebb553..b076086c 100644 --- a/Assets/Scripts/Streamingle/StreamingleControl/Controllers/SystemController.cs +++ b/Assets/Scripts/Streamingle/StreamingleControl/Controllers/SystemController.cs @@ -339,9 +339,10 @@ public class SystemController : MonoBehaviour byte[] bytes = screenshot.EncodeToPNG(); File.WriteAllBytes(fullPath, bytes); - // 정리 + // 정리 - RenderTexture는 Release() 후 Destroy() 호출 필요 screenshotCamera.targetTexture = currentRT; RenderTexture.active = null; + rt.Release(); Destroy(rt); Destroy(screenshot); @@ -420,10 +421,12 @@ public class SystemController : MonoBehaviour byte[] bytes = screenshot.EncodeToPNG(); File.WriteAllBytes(fullPath, bytes); - // 정리 + // 정리 - RenderTexture는 Release() 후 Destroy() 호출 필요 screenshotCamera.targetTexture = currentRT; RenderTexture.active = null; + rt.Release(); Destroy(rt); + alphaRT.Release(); Destroy(alphaRT); Destroy(screenshot);