feat: ClientPlayerAvatarNetworkAnimator added to handle client synchronizations [MTT-3152] by fernando-cortez · Pull Request #886 · Unity-Technologies/com.unity.multiplayer.samples.coop

Skip to content

Navigation Menu

Sign in

Appearance settings

Conversation

@fernando-cortez

Description

This PR rectifies two things:

  • A coroutine was used inside ServerAnimationHandler to wait until NetworkAnimator's Animator field had been assigned. That is no longer an issue with Netcode for GameObjects, and this NetworkBehaviour was also incorrectly playing an animation on newly joining clients on OnNetworkSpawn(). Instead, the NetworkAnimator's synchronize step should have handled applying its sync data to clients. However, players need to instantiate a model before the synchronize data is applied, and so:
  • ClientPlayerAvatarNetworkAnimator has been created to handle: instantiating the player model based on a networked GUID, rebinding this rig to the player's Animator, and applying synchronize data to said Animator.

To validate this fix:

  • Host and connect 1 client to host
  • Have either of the host or client faint
  • Join with a second client, and see that the fainted client's animation is correctly synchronized via NetworkAnimator

Issue Number(s)

MTT-3152

Contribution checklist

  • [ N/A ] Tests have been added for boss room and/or utilities pack
  • Release notes have been added to the project changelog file and/or package changelog file
  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • JIRA ticket ID is in the PR title or at least one commit message
  • Include the ticket ID number within the body message of the PR to create a hyperlink
  • [ N/A ] An Index entry has been added in readme.md if applicable

NoelStephensUnity

NoelStephensUnity

NoelStephensUnity

Choose a reason for hiding this comment

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

Minor nit picky thing I commented on...
But it looks good to me from a script perspective! 👍

NoelStephensUnity

Choose a reason for hiding this comment

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

👍

2 participants

@fernando-cortez @NoelStephensUnity