From 460348b2031293f66c6d824721a3c8d6a19ec8b2 Mon Sep 17 00:00:00 2001 From: Robin <1121080+rYuuk@users.noreply.github.com> Date: Wed, 20 Dec 2023 14:52:48 +0100 Subject: [PATCH] fix: add clearing of panel switcher --- .../LegacyAvatarCreator/Scripts/UI/CategoryUICreator.cs | 5 +++++ .../LegacyAvatarCreator/Scripts/UI/PanelSwitcher.cs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/Samples~/AvatarCreatorSamples/LegacyAvatarCreator/Scripts/UI/CategoryUICreator.cs b/Samples~/AvatarCreatorSamples/LegacyAvatarCreator/Scripts/UI/CategoryUICreator.cs index 82abf07d..c1651c8b 100644 --- a/Samples~/AvatarCreatorSamples/LegacyAvatarCreator/Scripts/UI/CategoryUICreator.cs +++ b/Samples~/AvatarCreatorSamples/LegacyAvatarCreator/Scripts/UI/CategoryUICreator.cs @@ -48,6 +48,11 @@ private void OnDisable() outfitCategoryButton.RemoveListener(); } + private void OnDestroy() + { + PanelSwitcher.Clear(); + } + private void Initialize() { categoryButtonsMap = new Dictionary(); diff --git a/Samples~/AvatarCreatorSamples/LegacyAvatarCreator/Scripts/UI/PanelSwitcher.cs b/Samples~/AvatarCreatorSamples/LegacyAvatarCreator/Scripts/UI/PanelSwitcher.cs index ba9da9c8..fd8df82c 100644 --- a/Samples~/AvatarCreatorSamples/LegacyAvatarCreator/Scripts/UI/PanelSwitcher.cs +++ b/Samples~/AvatarCreatorSamples/LegacyAvatarCreator/Scripts/UI/PanelSwitcher.cs @@ -64,6 +64,11 @@ public static void Switch(AssetType category) } } + public static void Clear() + { + CategoryPanelMap?.Clear(); + } + private static void DisableAllPanels() { foreach (var panels in CategoryPanelMap)