So i’ve followed the hello world page and the golden path page from the Netcode documentation and i wanted to create a simple project where multiple people join and move a cube around. The problem is when i join as a host i can move my cube but when someone else joins as a client it cannot move his cube.
The host cube’s transform is synced, the clients can see him moving but they cant move at all. I’ve found out that if i disable network transform component it will let me move the cube as a client but the transform will not be synced so i’m not sure what could be the problem…
here is the code for the movement script.
public class PlayerMovement : NetworkBehaviour
public float movementSpeed = 5f;
public CharacterController controller;
controller = GetComponent<CharacterController>();
transform.position = new Vector3(0f, 0.6f, 0f);
Vector3 input = new Vector3(Input.GetAxisRaw("Horizontal"), 0f, Input.GetAxisRaw("Vertical"));
input = Vector3.ClampMagnitude(input, 1f);
Vector3 movement = transform.TransformVector(input) * movementSpeed;
controller.Move(movement * Time.deltaTime);
here is the prefab i’m currently using
TLDR: Go to Package Manager → Netcode for GameObjects → Samples → Import ClientNetworkTransform. That gives you a client-authoritative network transform component.
Just been having this issue myself. From the NetworkTransform documentation page (https://docs-multiplayer.unity3d.com/docs/components/networktransform) :
NetworkTransform always synchronizes positions from the server to the clients and position changes on the clients are not allowed. Netcode for GameObjects comes with a sample containing a ClientNetworkTransform. This transform synchronizes the position of the owner client to the server and all other client allowing for client authoritative gameplay.
So when you use the default NetworkTransform component it only synchronises the transform from Server → to Client, meaning it doesn’t take the client into account at all. Your client’s movement inputs are being nullified because on the server end your object isn’t moving (i.e. server authority), if that makes sense. I replaced NetworkTransform with the ClientNetworkTransform you can get from the package manager and it worked as I expected.
My previous experience with Unity multiplayer was using Mirror which has a client authority option built into its NetworkTransform (I think it was the default setting?). As far as I can tell the entire point of the component is a convenient way to sync transforms of things like players, so I’m confused why the default component on Unity’s official solution is server authoritative with no options.
Seeing the same issue. Recreated and redone project multiple times with no success.