- Home /
Unity 5.1 networking sync player animations
I'm trying to understand the new networking infraastructure in Unity 5.1, and made a simple scene with a network manager spawning a ThirdPersonController prefab (that is in the Characters package).
I've updated the ThirdPersonUserControl
script to inherit from NetworkBehaviour
and do input evaluation only when isLocalPlayer
is true. I added NetworkIdentity
and NetworkTransform
components to the prefab. NetworkTransform.TransformSyncMode
has options for Sync {None, Transform, Rigidbody2D, Rigidbody3D and CharacterController
.
When I choose Rigidbody3D
and use a Local Host and Local Client, I can see the character move and be affected as a Rigidbody
, but without any animations. I thought syncing CharacterController
would fix it, but there's no movement at all if I choose that.
The prefab comes with a Third Person Character
script, which doesn't receive any messages, but is called from the Third Person User Control
script. It handles the animation updates based on movement. I'm not sure if I should be [SyncVar]
'ing all the members and such.
Sorry for rambling. My question is: What's the right way to ensure player animations are sync'd in a multiplayer scenario?
Answer by raja-bala · Jul 10, 2015 at 06:42 PM
Turns out you need to use send the movement as a command to be executed on the server, and make it issue a callback on the remote players character. http://forum.unity3d.com/threads/character-controller-sample-project.332770/#post-2198109
Github link: https://github.com/rajabala/SimpleMultiplayerTest
Answer by XiLiT · Jun 30, 2017 at 07:17 AM
USE NETWORKANIMATOR!!! :D https://docs.unity3d.com/Manual/class-NetworkAnimator.html