mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
CommandMessageCallsCommandTest: proper usage of weaver generated command code (static!)
This commit is contained in:
parent
6d2b4eb102
commit
1315bd3dde
@ -11,7 +11,10 @@ public class CommandTestNetworkBehaviour : NetworkBehaviour
|
||||
public bool commandCalled;
|
||||
// weaver generates this from [Command]
|
||||
// but for tests we need to add it manually
|
||||
public void CommandGenerated(NetworkBehaviour comp, NetworkReader reader) { commandCalled = true; }
|
||||
public static void CommandGenerated(NetworkBehaviour comp, NetworkReader reader)
|
||||
{
|
||||
((CommandTestNetworkBehaviour)comp).commandCalled = true;
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixture]
|
||||
@ -579,7 +582,7 @@ public void CommandMessageCallsCommandTest()
|
||||
connection.identity = identity;
|
||||
|
||||
// register the command delegate, otherwise it's not found
|
||||
NetworkBehaviour.RegisterCommandDelegate(typeof(CommandTestNetworkBehaviour), nameof(CommandTestNetworkBehaviour.CommandGenerated), comp.CommandGenerated);
|
||||
NetworkBehaviour.RegisterCommandDelegate(typeof(CommandTestNetworkBehaviour), nameof(CommandTestNetworkBehaviour.CommandGenerated), CommandTestNetworkBehaviour.CommandGenerated);
|
||||
|
||||
// identity needs to be in spawned dict, otherwise command handler
|
||||
// won't find it
|
||||
|
Loading…
Reference in New Issue
Block a user