com.unity.netcode.gameobjects icon indicating copy to clipboard operation
com.unity.netcode.gameobjects copied to clipboard

Network animator only syncing animations to clients if the are more than 2 clients connected

Open ChadGatling opened this issue 3 years ago • 3 comments

Description

On the network animator component. There is this check in the send animation functions:

if (NetworkManager.ConnectedClientsIds.Count - 2 > 0)

I believe this meant to be a comparison of greater than or equal. As when there are only 2 connected clients this returns false and the animations are not sent to any client from the server. After a third client joins all the clients can see the animations of all the other clients.

This may be a result from testing based on hosted servers where there will only be one remote client and a host. Since the host is on the server he would be seeing the client's animations while sending his animations to the client. While the client would be seeing his own animations and sending his to the server(host). This check malfunctions when a dedicated server is used since the total number of clients will be less than 3 while also not having any player be on the server where the animations will always be expected.

Reproduce Steps

  1. Set your Network Animator component to owner authoritative
  2. Run a dedicated server
  3. connect 2 clients
  4. observe that neither client gets the other's animations
  5. connect a 3rd client
  6. observe that each client can now see there others' animations

Actual Outcome

Animations from clients are not synced when only 2 clients are connected to a dedicated server.

Expected Outcome

A client should be able to see the other client's animation on a dedicated server.

Environment

  • OS: Windows 10
  • Unity Version: 2021.10f1
  • Netcode Version: 1.0.0
  • Netcode Commit: https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/commit/d23f93dba59239a8e5822db61fd1f9d14312898e

ChadGatling avatar Aug 20 '22 14:08 ChadGatling

This is probably a duplicate bug. @NoelStephensUnity Related to https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/issues/2114 Possible fix: https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/pull/2127

Tracked in backlog with existing bug https://jira.unity3d.com/browse/MTT-4384

ashwinimurt avatar Aug 22 '22 18:08 ashwinimurt

Is Netcode still an experimental/beta package? Having such a critical bug open for a month is frustrating since having two clients is the primary way of testing for me as 3+ clients is harder to setup locally.

Regardless, I appreciate the bug post and those working on the issue.

Shivang44 avatar Sep 14 '22 01:09 Shivang44

@Shivang44 Apologies for the delay as I was diverted to the most recent update (v1.0.2). I am finishing up PR-2127, and this will be included in the next update. Not sure on the precise ETA for the next update, but it should be sometime this month. If this issue is blocking you (sounding like it is), feel free to use the branch of PR-2127 until the package update. Let me know if you need assistance with getting that branch.

NoelStephensUnity avatar Sep 14 '22 16:09 NoelStephensUnity

#2127 has been merged and should be in the next update!

NoelStephensUnity avatar Sep 28 '22 22:09 NoelStephensUnity