-
Notifications
You must be signed in to change notification settings - Fork 450
fix: Adding exception for silent failure for clients getting other player's object #844
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
fix: Adding exception for silent failure for clients getting other player's object #844
Conversation
… silent failures calling this client side expecting to see other player objects. This solves issue #581
com.unity.multiplayer.mlapi/Runtime/Spawning/NetworkSpawnManager.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
/// </summary> | ||
/// <returns>The player object with a given clientId or null if one does not exist</returns> | ||
public NetworkObject GetPlayerNetworkObject(ulong clientId) | ||
{ | ||
if (!NetworkManager.Singleton.IsServer && NetworkManager.Singleton.LocalClientId != clientId) | ||
{ | ||
throw new NotServerException("Only the server can find player objects from other clients."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unit tests by a chance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
Adding the possibility to have multiple clients in MultiInstanceHelpers Updating exception check to make sure to use local networkmanager (so it works with tests)
…player-object-get * develop: test: manual connection approval to fully automated connection approval testing (#839) test: manual rpc tests to automated fixed revision (#841) fix: CleanDiffedSceneObjects was not clearing PendingSoftSyncObjects (#834) feat: NetworkTransform now uses NetworkVariables instead of RPCs (#826) fix: gracefully handle exceptions in an RPC invoke (#846) fix: Fixing utp license file for legal (#843) ci: enable standards check on UTP too (#837) refactor: NetworkBehaviour.NetworkObject no longer throws an exception (#838) fix: revert #830 (#840) test: converting the manual rpc tests over to an automated unit test (#830) # Conflicts: # com.unity.multiplayer.mlapi/Tests/Runtime/MultiInstance/MultiInstanceHelpers.cs
Adding separate tests in SpawnManagerTests. Added Teardown
Added tests and necessary improvement to multi instance helper. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌🏻
…player-object-get
I encountered this issue myself in our test project and I'm seeing there's already an issue opened for this here
#581
This fixes a silent fail where a client would expect to see other player's objects in that list, but would only get its own player object.
Only the server will see other player objects.
This doesn't solve the issue with actually adding other clients to a client's list. Some games might want to hide other players from each other or AoI could hide some players. This shouldn't be handled here.
Users can still tracking players spawning themselves (it's a one liner to statically track player spawns in a Dictionary)