From 81e546e3feae33e6c7d2c29429cb22077f839a92 Mon Sep 17 00:00:00 2001 From: minenice55 Date: Sat, 20 Jan 2024 23:39:41 -0500 Subject: [PATCH] rendertexture null check --- Assets/Scripts/GlobalGameManager.cs | 33 ++++++++++++++----- ...Generator.Editor.ProjectSettingsData.asset | 1 + 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Assets/Scripts/GlobalGameManager.cs b/Assets/Scripts/GlobalGameManager.cs index 10984337..16d44ebf 100644 --- a/Assets/Scripts/GlobalGameManager.cs +++ b/Assets/Scripts/GlobalGameManager.cs @@ -399,20 +399,35 @@ namespace HeavenStudio height = (int)(width / 16f * 9f); } - GameRenderTexture.Release(); + if (GameRenderTexture != null) + { + GameRenderTexture.Release(); - GameRenderTexture.width = width; - GameRenderTexture.height = height; + GameRenderTexture.width = width; + GameRenderTexture.height = height; - GameRenderTexture.Create(); + GameRenderTexture.Create(); + } + else + { + GameRenderTexture = new RenderTexture(width, height, 24); + GameRenderTexture.Create(); + } + if (OverlayRenderTexture != null) + { + OverlayRenderTexture.Release(); - OverlayRenderTexture.Release(); + OverlayRenderTexture.width = (int)(width * 1.5f); + OverlayRenderTexture.height = (int)(height * 1.5f); - OverlayRenderTexture.width = (int)(width * 1.5f); - OverlayRenderTexture.height = (int)(height * 1.5f); - - OverlayRenderTexture.Create(); + OverlayRenderTexture.Create(); + } + else + { + OverlayRenderTexture = new RenderTexture((int)(width * 1.5f), (int)(height * 1.5f), 24); + OverlayRenderTexture.Create(); + } } public static void ChangeMasterVolume(float value) diff --git a/ProjectSettings/SatorImaging.UnitySourceGenerator.Editor.ProjectSettingsData.asset b/ProjectSettings/SatorImaging.UnitySourceGenerator.Editor.ProjectSettingsData.asset index 1ac79110..3d3b4ba6 100644 --- a/ProjectSettings/SatorImaging.UnitySourceGenerator.Editor.ProjectSettingsData.asset +++ b/ProjectSettings/SatorImaging.UnitySourceGenerator.Editor.ProjectSettingsData.asset @@ -31,5 +31,6 @@ MonoBehaviour: - Assets/Scripts/InputSystem/PlayerInput.cs - Assets/Scripts/JudgementManager.cs - Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/RatingScreenPropertyDialog.cs + - Assets/Scripts/GlobalGameManager.cs PathsToSkipImportEvent: [] PathsToIgnoreOverwriteSettingOnAttribute: []