From bdece9f3d9dc74febb197f7e5803e665b60bbf34 Mon Sep 17 00:00:00 2001 From: Quantumrunner <58113888+Quantumrunner@users.noreply.github.com> Date: Thu, 4 Apr 2024 21:05:36 +0200 Subject: [PATCH] Added new tag in unity tag manager (https://docs.unity3d.com/410/Documentation/Components/class-TagManager.html) to ensure components on new page or cleaned up correctly when leaving the page. --- unity/Assets/Scripts/Destroyer.cs | 8 ++++++++ .../Scripts/UI/Screens/ContentSelectDownloadScreen.cs | 11 +++++------ unity/ProjectSettings/TagManager.asset | 2 ++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/unity/Assets/Scripts/Destroyer.cs b/unity/Assets/Scripts/Destroyer.cs index 43726182..368a4c5d 100644 --- a/unity/Assets/Scripts/Destroyer.cs +++ b/unity/Assets/Scripts/Destroyer.cs @@ -37,6 +37,14 @@ public static void Destroy() foreach (GameObject go in GameObject.FindGameObjectsWithTag(Game.QUESTLIST)) Object.Destroy(go); + // Clean up everything marked as 'contentpackui' + foreach (GameObject go in GameObject.FindGameObjectsWithTag(Game.CONTENTPACKUI)) + Object.Destroy(go); + + // Clean up everything marked as 'contentpacklist' + foreach (GameObject go in GameObject.FindGameObjectsWithTag(Game.CONTENTPACKLIST)) + Object.Destroy(go); + // Clean up everything marked as 'editor' foreach (GameObject go in GameObject.FindGameObjectsWithTag(Game.EDITOR)) Object.Destroy(go); diff --git a/unity/Assets/Scripts/UI/Screens/ContentSelectDownloadScreen.cs b/unity/Assets/Scripts/UI/Screens/ContentSelectDownloadScreen.cs index 74e97119..82c83ee4 100644 --- a/unity/Assets/Scripts/UI/Screens/ContentSelectDownloadScreen.cs +++ b/unity/Assets/Scripts/UI/Screens/ContentSelectDownloadScreen.cs @@ -71,6 +71,11 @@ private static void CleanUpDialogs() { Destroy(go); } + + foreach (GameObject go in GameObject.FindGameObjectsWithTag(Game.CONTENTPACKLIST)) + { + Destroy(go); + } } private void DrawContentPackList() @@ -137,7 +142,6 @@ private void RenderDeleteButton(float offset, KeyValuePair 0) { - //if (game.questsList.quest_list_mode != QuestsManager.QuestListMode.ONLINE) - //{ - // DrawPicture(ContentData.FileToTexture(Path.Combine(contentPack.Value., contentPack.Value.image)), ui); ; - //} - //else if (images_list.IsImageAvailable(contentPack.Value.package_url + contentPack.Value.image)) { DrawPicture(images_list.GetTexture(contentPack.Value.package_url + contentPack.Value.image), ui); diff --git a/unity/ProjectSettings/TagManager.asset b/unity/ProjectSettings/TagManager.asset index 29fa961d..2fa3dcfb 100644 --- a/unity/ProjectSettings/TagManager.asset +++ b/unity/ProjectSettings/TagManager.asset @@ -21,6 +21,8 @@ TagManager: - questlist - setwindow - dialogPart + - contentpackui + - contentpacklist layers: - Default - TransparentFX