mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
NetworkServerTests: SendCommand test simplified
This commit is contained in:
parent
4f72d5f8f6
commit
b340397ad0
@ -762,17 +762,10 @@ public void SendCommand_CalledOnCorrectComponent()
|
|||||||
NetworkServer.Listen(1);
|
NetworkServer.Listen(1);
|
||||||
ConnectClientBlockingAuthenticatedAndReady(out NetworkConnectionToClient connectionToClient);
|
ConnectClientBlockingAuthenticatedAndReady(out NetworkConnectionToClient connectionToClient);
|
||||||
|
|
||||||
// add an identity with two networkbehaviour components
|
// add an identity with two networkbehaviour components.
|
||||||
CreateNetworked(out GameObject _, out NetworkIdentity identity, out CommandTestNetworkBehaviour comp0, out CommandTestNetworkBehaviour comp1);
|
// spawned, otherwise command handler won't find it in .spawned.
|
||||||
identity.netId = 42;
|
CreateNetworkedAndSpawn(out GameObject _, out NetworkIdentity identity, out CommandTestNetworkBehaviour comp0, out CommandTestNetworkBehaviour comp1, connectionToClient);
|
||||||
identity.isLocalPlayer = true;
|
identity.isLocalPlayer = true;
|
||||||
// for authority check
|
|
||||||
identity.connectionToClient = connectionToClient;
|
|
||||||
connectionToClient.identity = identity;
|
|
||||||
|
|
||||||
// identity needs to be in spawned dict, otherwise command handler
|
|
||||||
// won't find it
|
|
||||||
NetworkIdentity.spawned[identity.netId] = identity;
|
|
||||||
|
|
||||||
// call the command
|
// call the command
|
||||||
comp1.TestCommand();
|
comp1.TestCommand();
|
||||||
|
Loading…
Reference in New Issue
Block a user