From e50a3d8427524f324f30429fc1830d7eb8336849 Mon Sep 17 00:00:00 2001 From: LPLafontaineB Date: Wed, 4 Jan 2023 15:55:38 -0500 Subject: [PATCH] fix: removing warning when spawning powerups (#90) * updating NetworkVariable after the NetworkObject is spawned --- Basic/2DSpaceShooter/Assets/Scripts/Spawner.cs | 2 +- CHANGELOG.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Basic/2DSpaceShooter/Assets/Scripts/Spawner.cs b/Basic/2DSpaceShooter/Assets/Scripts/Spawner.cs index dd344b2df..0bede2154 100644 --- a/Basic/2DSpaceShooter/Assets/Scripts/Spawner.cs +++ b/Basic/2DSpaceShooter/Assets/Scripts/Spawner.cs @@ -152,8 +152,8 @@ void Update() GameObject powerUp = m_ObjectPool.GetNetworkObject(m_PowerupPrefab).gameObject; powerUp.transform.position = pos; - powerUp.GetComponent().buffType.Value = (Buff.BuffType)Random.Range(0, (int)Buff.BuffType.Last); powerUp.GetComponent().Spawn(true); + powerUp.GetComponent().buffType.Value = (Buff.BuffType)Random.Range(0, (int)Buff.BuffType.Last); } if (Asteroid.numAsteroids == 0) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87fceb17a..49cb8c17e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### 2DSpaceShooter ### Fixed +- Removing warning when spawning powerups (#90). Fixed the order in which powerups were spawned and when their NetworkVariable value was initialized. Now they are spawned beforehand. - Fixing bullet explosion desync (#89). Bullet explosion vfx were happening too early on clients because of NetworkTransform's interpolation. Bullets are now no longer synchronised by NetworkTransforms and instead only have their velocity set through client rpcs when they are spawned. Since they are no longer interpolated, they are not lagging behind the server and are at the correct position when they receive the despawn message from the server. ## [1.1.0] - 2022-12-13