Skip to content

fix: host NetworkManager.LocalClient not being set #1511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Dec 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions com.unity.netcode.gameobjects/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
- Fixed: Fixed error when serializing ConnectionApprovalMessage with scene management disabled when one or more objects is hidden via the CheckObjectVisibility delegate (#1509)
- Fixed KeyNotFound exception when removing ownership of a newly spawned NetworkObject that is already owned by the server. (#1500)
- Fixed issue where pooled NetworkObjects using NetworkTransform would interpolate from their last de-spawned position to the newly spawned position (#1505)
- Fixed NetworkManager.LocalClient not being set when starting as a host. (#1511)

### Changed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1673,6 +1673,7 @@ internal void HandleApproval(ulong ownerClientId, bool createPlayerObject, uint?
}
else // Server just adds itself as an observer to all spawned NetworkObjects
{
LocalClient = client;
SpawnManager.UpdateObservedNetworkObjects(ownerClientId);
InvokeOnClientConnectedCallback(ownerClientId);
}
Expand Down
16 changes: 16 additions & 0 deletions testproject/Assets/Tests/Runtime/NetworkManagerTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using NUnit.Framework;
using Unity.Netcode.RuntimeTests;

namespace TestProject.RuntimeTests
{
public class NetworkManagerTests : BaseMultiInstanceTest
{
protected override int NbClients => 1;

[Test]
public void ValidateHostLocalClient()
{
Assert.IsTrue(m_ServerNetworkManager.LocalClient != null);
}
}
}
11 changes: 11 additions & 0 deletions testproject/Assets/Tests/Runtime/NetworkManagerTests.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.