Skip to content

Commit

Permalink
fix: removing warning when spawning powerups (#90)
Browse files Browse the repository at this point in the history
* updating NetworkVariable after the NetworkObject is spawned
  • Loading branch information
LPLafontaineB authored Jan 4, 2023
1 parent 7a0900d commit e50a3d8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Basic/2DSpaceShooter/Assets/Scripts/Spawner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ void Update()

GameObject powerUp = m_ObjectPool.GetNetworkObject(m_PowerupPrefab).gameObject;
powerUp.transform.position = pos;
powerUp.GetComponent<Powerup>().buffType.Value = (Buff.BuffType)Random.Range(0, (int)Buff.BuffType.Last);
powerUp.GetComponent<NetworkObject>().Spawn(true);
powerUp.GetComponent<Powerup>().buffType.Value = (Buff.BuffType)Random.Range(0, (int)Buff.BuffType.Last);
}

if (Asteroid.numAsteroids == 0)
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e50a3d8

Please sign in to comment.