Skip to content

Commit 9195c5a

Browse files
authored
fix: host NetworkManager.LocalClient not being set (#1536)
1 parent 81dd1e4 commit 9195c5a

File tree

4 files changed

+29
-0
lines changed

4 files changed

+29
-0
lines changed

com.unity.netcode.gameobjects/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
2828
- Fixed NetworkObjects not being despawned before they are destroyed during shutdown for client, host, and server instances. (#1390)
2929
- Fixed KeyNotFound exception when removing ownership of a newly spawned NetworkObject that is already owned by the server. (#1500)
3030
- Fixed issue where pooled NetworkObjects using NetworkTransform would interpolate from their last de-spawned position to the newly spawned position (#1505)
31+
- Fixed NetworkManager.LocalClient not being set when starting as a host. (#1511)
3132

3233
### Changed
3334

com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,6 +1636,7 @@ internal void HandleApproval(ulong ownerClientId, bool createPlayerObject, uint?
16361636
}
16371637
else // Server just adds itself as an observer to all spawned NetworkObjects
16381638
{
1639+
LocalClient = client;
16391640
SpawnManager.UpdateObservedNetworkObjects(ownerClientId);
16401641
InvokeOnClientConnectedCallback(ownerClientId);
16411642
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using NUnit.Framework;
2+
using Unity.Netcode.RuntimeTests;
3+
4+
namespace TestProject.RuntimeTests
5+
{
6+
public class NetworkManagerTests : BaseMultiInstanceTest
7+
{
8+
protected override int NbClients => 1;
9+
10+
[Test]
11+
public void ValidateHostLocalClient()
12+
{
13+
Assert.IsTrue(m_ServerNetworkManager.LocalClient != null);
14+
}
15+
}
16+
}

testproject/Assets/Tests/Runtime/NetworkManagerTests.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)