I am new to Unity networking. I've set up my scene with NetworkManager and the Player prefab having NetworkIdentity. I originally had my players set up to sync with a NetworkTransform. This worked, but the objects were very choppy whenever they were children of a moving object.
In order to fix this issue, I've replaced NetworkTransform with a class extending NetworkBehavior, using UnityEngine.Networking, and containing the following code to sync localPosition:
void Update () {
CmdSyncPos (transform.localPosition, transform.localRotation);
}
[Command]
protected void CmdSyncPos (Vector3 localPos, Quaternion localRotation) {
transform.localPosition = localPos;
transform.localRotation = localRotation;
}
This works really well! The only problem is that this is one-way, the server now has the updated position of all clients but the clients only have the updated versions of themselves.
How can I do this in reverse: Manually sync the location of non-local players from server to client?