From d3ccc7227016a01b24f74ecff321d2fa1468985a Mon Sep 17 00:00:00 2001 From: eheimburg <74330250+eheimburg@users.noreply.github.com> Date: Mon, 19 Apr 2021 08:36:55 -0400 Subject: [PATCH 1/3] Ensure entities spawned by the testing hotkeys are correctly destroyed when scene changes --- Assets/BossRoom/Scripts/Server/ServerTestingHotkeys.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/BossRoom/Scripts/Server/ServerTestingHotkeys.cs b/Assets/BossRoom/Scripts/Server/ServerTestingHotkeys.cs index d8ce6aa45..4f14d7e31 100644 --- a/Assets/BossRoom/Scripts/Server/ServerTestingHotkeys.cs +++ b/Assets/BossRoom/Scripts/Server/ServerTestingHotkeys.cs @@ -50,12 +50,12 @@ private void Update() if (m_SpawnEnemyKeyCode != KeyCode.None && Input.GetKeyDown(m_SpawnEnemyKeyCode)) { var newEnemy = Instantiate(m_EnemyPrefab); - newEnemy.SpawnWithOwnership(NetworkManager.Singleton.LocalClientId); + newEnemy.SpawnWithOwnership(NetworkManager.Singleton.LocalClientId, null, false); } if (m_SpawnBossKeyCode != KeyCode.None && Input.GetKeyDown(m_SpawnBossKeyCode)) { var newEnemy = Instantiate(m_BossPrefab); - newEnemy.SpawnWithOwnership(NetworkManager.Singleton.LocalClientId); + newEnemy.SpawnWithOwnership(NetworkManager.Singleton.LocalClientId, null, false); } if (m_InstantQuitKeyCode != KeyCode.None && Input.GetKeyDown(m_InstantQuitKeyCode)) { From bd0ee3350a6243df8aa88ade6d98784b19bbef85 Mon Sep 17 00:00:00 2001 From: eheimburg <74330250+eheimburg@users.noreply.github.com> Date: Mon, 19 Apr 2021 08:40:51 -0400 Subject: [PATCH 2/3] Update ServerTestingHotkeys.cs --- Assets/BossRoom/Scripts/Server/ServerTestingHotkeys.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/BossRoom/Scripts/Server/ServerTestingHotkeys.cs b/Assets/BossRoom/Scripts/Server/ServerTestingHotkeys.cs index 4f14d7e31..7a4c70643 100644 --- a/Assets/BossRoom/Scripts/Server/ServerTestingHotkeys.cs +++ b/Assets/BossRoom/Scripts/Server/ServerTestingHotkeys.cs @@ -50,12 +50,12 @@ private void Update() if (m_SpawnEnemyKeyCode != KeyCode.None && Input.GetKeyDown(m_SpawnEnemyKeyCode)) { var newEnemy = Instantiate(m_EnemyPrefab); - newEnemy.SpawnWithOwnership(NetworkManager.Singleton.LocalClientId, null, false); + newEnemy.SpawnWithOwnership(NetworkManager.Singleton.LocalClientId, null, true); } if (m_SpawnBossKeyCode != KeyCode.None && Input.GetKeyDown(m_SpawnBossKeyCode)) { var newEnemy = Instantiate(m_BossPrefab); - newEnemy.SpawnWithOwnership(NetworkManager.Singleton.LocalClientId, null, false); + newEnemy.SpawnWithOwnership(NetworkManager.Singleton.LocalClientId, null, true); } if (m_InstantQuitKeyCode != KeyCode.None && Input.GetKeyDown(m_InstantQuitKeyCode)) { From f4b9e47b9e2d4b01a7a45e39dcc4242bb53a8ac9 Mon Sep 17 00:00:00 2001 From: eheimburg <74330250+eheimburg@users.noreply.github.com> Date: Tue, 20 Apr 2021 03:01:19 -0400 Subject: [PATCH 3/3] remove #if check --- Assets/BossRoom/Scripts/Server/ServerTestingHotkeys.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Assets/BossRoom/Scripts/Server/ServerTestingHotkeys.cs b/Assets/BossRoom/Scripts/Server/ServerTestingHotkeys.cs index 7a4c70643..79878c7c1 100644 --- a/Assets/BossRoom/Scripts/Server/ServerTestingHotkeys.cs +++ b/Assets/BossRoom/Scripts/Server/ServerTestingHotkeys.cs @@ -5,13 +5,11 @@ namespace BossRoom.Server { /// /// Provides various special commands that the Host can use while developing and - /// debugging the game. These are not compiled into release builds. (If you want - /// to disable them for debug builds, disable or remove this component from the - /// BossRoomState prefab.) + /// debugging the game. To disable them, just disable or remove this component from the + /// BossRoomState prefab. /// public class ServerTestingHotkeys : NetworkBehaviour { -#if UNITY_EDITOR || DEVELOPMENT_BUILD [SerializeField] [Tooltip("Enemy to spawn. Make sure this is included in the NetworkManager's list of prefabs!")] private NetworkObject m_EnemyPrefab; @@ -63,6 +61,5 @@ private void Update() MLAPI.SceneManagement.NetworkSceneManager.SwitchScene("PostGame"); } } -#endif } }