Skip to content

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

Conversation

SamuelBellomo
Copy link
Contributor

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)

… silent failures calling this client side expecting to see other player objects. This solves issue #581
@SamuelBellomo SamuelBellomo changed the title Adding exception for silent failure fix: Adding exception for silent failure May 19, 2021
@SamuelBellomo SamuelBellomo changed the title fix: Adding exception for silent failure fix: Adding exception for silent failure for clients getting other player's object May 19, 2021
Copy link
Contributor

@LukeStampfli LukeStampfli left a 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.");
Copy link
Contributor

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?

Copy link
Contributor Author

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
@SamuelBellomo
Copy link
Contributor Author

Added tests and necessary improvement to multi instance helper.

…player-object-get

* develop:
  fix: snapshot system. Properly gating the SnapshotSystem from being used until is is ready and specifically enabled (#852)
  test:  verifies that a user can use INetworkSerializable with RPCs (#850)
Copy link
Contributor

@TwoTenPvP TwoTenPvP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌🏻

@SamuelBellomo SamuelBellomo merged commit 4b15869 into develop May 21, 2021
@SamuelBellomo SamuelBellomo deleted the feature/adding-exception-for-client-side-player-object-get branch May 21, 2021 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants