- Home /
Network. Send to client server info.
The problem is - server have all myTransform of all players and correctly shows their location. But client have myTransform only of his playercontroller. How to pass myTransform of all connected players to client when he connecting 1st time?
public Transform myTransform;
[Command]
public void Cmd_SpawnPlayer(GameObject go)
{
GameObject playerPref = Instantiate(playerPrefub, new Vector3(10400, 10000, 90), Quaternion.identity) as GameObject;
NetworkServer.SpawnWithClientAuthority(playerPref, go);
Rpc_RecievePlayerGameObject(playerPref);
}
[ClientRpc]
void Rpc_RecievePlayerGameObject(GameObject player)
{
GetComponent<MainCameraScript>().player = player;
myTransform = player.transform;
}
Comment