From 043f77720707aca486506d14186746cbb71d7a1e Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 5 May 2023 13:20:14 -0700 Subject: [PATCH] fixed: menu navigation, singleton bugs quit buttons in pause menus are fixed. also the persistent data objects were not deleting themselves if another copy exists, so that's been fixed --- .../PersistantData/StateController.prefab | 22 +++---------------- Assets/Scripts/DebugSceneSwitcher.cs | 8 +++++++ Assets/Scripts/SceneController.cs | 6 ++--- Assets/Scripts/StateController.cs | 9 +++++++- 4 files changed, 22 insertions(+), 23 deletions(-) diff --git a/Assets/Prefabs/DEBUG/PersistantData/StateController.prefab b/Assets/Prefabs/DEBUG/PersistantData/StateController.prefab index d87d4bb..e3c6380 100644 --- a/Assets/Prefabs/DEBUG/PersistantData/StateController.prefab +++ b/Assets/Prefabs/DEBUG/PersistantData/StateController.prefab @@ -9,7 +9,6 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 5026779833035567294} - - component: {fileID: 3993188859025174202} - component: {fileID: 4111321198473826588} - component: {fileID: 5193521544595985828} m_Layer: 0 @@ -32,25 +31,8 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 1 + m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &3993188859025174202 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5592250714439549880} - m_Enabled: 0 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 73653b02e42804d288eaaf881c511225, type: 3} - m_Name: - m_EditorClassIdentifier: - canTrumpet: 1 - canTambourine: 1 - canClarinet: 1 - canCymbal: 1 - currentState: 0 --- !u!114 &4111321198473826588 MonoBehaviour: m_ObjectHideFlags: 0 @@ -69,6 +51,8 @@ MonoBehaviour: isPaused: 0 pauseMenuCanvas: {fileID: 0} inDebugMode: 1 + debugCanvas: {fileID: 0} + itemProgression: 0 --- !u!114 &5193521544595985828 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/DebugSceneSwitcher.cs b/Assets/Scripts/DebugSceneSwitcher.cs index b673019..b09ef57 100644 --- a/Assets/Scripts/DebugSceneSwitcher.cs +++ b/Assets/Scripts/DebugSceneSwitcher.cs @@ -6,10 +6,18 @@ using TMPro; public class DebugSceneSwitcher : MonoBehaviour { + public static DebugSceneSwitcher Instance = null; + public bool showDropdown; void Awake() { + if (Instance == null) { + Instance = this; + } else { + Destroy(this.gameObject); + return; + } // Keep the object around when we switch scenes DontDestroyOnLoad(this.gameObject); CreateDropdownOptions(); diff --git a/Assets/Scripts/SceneController.cs b/Assets/Scripts/SceneController.cs index 6223709..a32615c 100644 --- a/Assets/Scripts/SceneController.cs +++ b/Assets/Scripts/SceneController.cs @@ -18,7 +18,7 @@ public class SceneController : MonoBehaviour } else { - Destroy(this); + Destroy(this.gameObject); return; } // Make this object stay around when switching scenes @@ -31,8 +31,8 @@ public class SceneController : MonoBehaviour GameObject pauseMenu = GameObject.Find("PauseMenuCanvas"); if (pauseMenu != null) { - Button quitButton = GameObject.Find("QuitButton").GetComponent