Multiplayer - Object can not be moved by client player, only host player can move it.

Hi all,

I’m currently using the Unity NetworkManager to connect a host and client via LAN.

The connection works, both players can see the same set of objects.

In the game area, there is a Cube object which has a Network Transform. The host player goes to pick this item and can thrown the object about, both players can see this happen.

The client goes to pick up the object and can do so, however the host player cannot see this happen.

In addition, once the client no longer has the object in their hand, it teleports back to the position where the host’s object is.

Both players can move around but for some reason, it appears the second player can only manipulate the object on their side, this is not picked up by the server.

The object in question is created in the world once the host enters the game and before the client enters the game.

Any ideas? I’ve been lost with this for about five hours now! It’s rather weird how both players seam to be in the same environment and are recognised by the server yet the object can only be controlled and manipulated by the host!

Cheers.

Hey @nushidorei, I had the same problem and I figured it out. What I did was, I created a GameManager gameobject, attached a script with NetworkBehaviour and in there OnStartServer I Instantiated and spawned the cube in the server with NetworkServer.Spawn(). I also added the cube in the spawnable prefabs in the NetworkManager. To synchronize movement across all clients I added a NetworkTransform to the cube and setup an example to press E and move the cube, so in my PlayerController script when I press E it calls a [Command] and inside the Command it calls a [ClientRpc] and inside there it moves the cube. Hope that helped, in case you haven’t figured it out yet.