Skip to content

Commit e50a3d8

Browse files
fix: removing warning when spawning powerups (#90)
* updating NetworkVariable after the NetworkObject is spawned
1 parent 7a0900d commit e50a3d8

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Basic/2DSpaceShooter/Assets/Scripts/Spawner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ void Update()
152152

153153
GameObject powerUp = m_ObjectPool.GetNetworkObject(m_PowerupPrefab).gameObject;
154154
powerUp.transform.position = pos;
155-
powerUp.GetComponent<Powerup>().buffType.Value = (Buff.BuffType)Random.Range(0, (int)Buff.BuffType.Last);
156155
powerUp.GetComponent<NetworkObject>().Spawn(true);
156+
powerUp.GetComponent<Powerup>().buffType.Value = (Buff.BuffType)Random.Range(0, (int)Buff.BuffType.Last);
157157
}
158158

159159
if (Asteroid.numAsteroids == 0)

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### 2DSpaceShooter
66

77
### Fixed
8+
- 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.
89
- 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.
910

1011
## [1.1.0] - 2022-12-13

0 commit comments

Comments
 (0)