Skip to content
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

NetworkClient.connection: type changed from NetworkConnection to explicit NetworkConnectionToServer to ensure correct usage. C# has a great type system, we should use to prevent issues. #3464

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Assets/Mirror/Core/NetworkClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static partial class NetworkClient
new Dictionary<uint, NetworkIdentity>();

/// <summary>Client's NetworkConnection to server.</summary>
public static NetworkConnection connection { get; internal set; }
public static NetworkConnectionToServer connection { get; internal set; }

/// <summary>True if client is ready (= joined world).</summary>
// TODO redundant state. point it to .connection.isReady instead (& test)
Expand Down
6 changes: 6 additions & 0 deletions Assets/Mirror/Tests/Common/FakeNetworkConnectionToServer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Mirror.Tests
{
public class FakeNetworkConnectionToServer : NetworkConnectionToServer
{
}
}

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

2 changes: 1 addition & 1 deletion Assets/Mirror/Tests/Editor/ClientSceneTests_OnSpawn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ public void ApplyPayload_LocalPlayerAddsIdentityToConnection()
payload = default,
};

NetworkClient.connection = new FakeNetworkConnectionToClient();
NetworkClient.connection = new FakeNetworkConnectionToServer();
NetworkClient.ready = true;
NetworkClient.ApplySpawnPayload(identity, msg);

Expand Down