-
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fixing use of network identity in network message (#955)
adding objectLocator to object locator so that it can be used to find objects when reading network messages
- Loading branch information
1 parent
6395251
commit bc1b82a
Showing
6 changed files
with
51 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
Assets/Tests/Runtime/ClientServer/NetworkIdentityMessageTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using NUnit.Framework; | ||
|
||
namespace Mirage.Tests.Runtime.ClientServer | ||
{ | ||
public class NetworkIdentityMessageTest : ClientServerSetup<MockComponent> | ||
{ | ||
[NetworkMessage] | ||
public struct MyMessage | ||
{ | ||
public NetworkIdentity player1; | ||
} | ||
|
||
[Test] | ||
public void MessageFindsNetworkIdentities() | ||
{ | ||
NetworkIdentity found = null; | ||
client.MessageHandler.RegisterHandler((MyMessage msg) => | ||
{ | ||
found = msg.player1; | ||
}); | ||
serverPlayer.Send(new MyMessage { player1 = serverPlayer.Identity }); | ||
|
||
server.Update(); | ||
client.Update(); | ||
|
||
Assert.That(found == clientPlayer.Identity, "Could not find client version of object"); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/Tests/Runtime/ClientServer/NetworkIdentityMessageTest.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters