I’m using my own override method for player spawning as I quickly integrated my old spawnpoint system from old networking. Everything is working fine, players appear in the right positions… except for the rotation.
As I have some client prediction/lag compensation/peer interpolation system I’m migrating, I do not use automtic syncing via NetworkTransform - it would not work together with the existing code I have.
public override void OnServerAddPlayer(NetworkConnection conn, short playerControllerId)
{
Debug.Log(name + ": OnServerAddPlayer");
PlayerSpawnPoint spawnPoint = PlayerSpawnPoint.Next();
Vector3 position = Vector3.zero;
Quaternion rotation = Quaternion.identity;
if (spawnPoint != null)
{
position = spawnPoint.position;
rotation = spawnPoint.rotation;
Debug.Log(rotation);
}
GameObject player = (GameObject)GameObject.Instantiate(playerPrefab, position, rotation);
playerTracker.Add(player);
NetworkServer.AddPlayerForConnection(conn, player, playerControllerId);
}
Next I tried to switch to the Network start position Manager of NetworkManager (meaning not overriding OnServerAddPlayer() and calling NetworkManager.RegisterStartPosition(transform); for my spawnpoints), but the result stays exactly the same.
Is this intended?
Because it doesn’t seem logical if I instantiate with position and rotation, but only position is transferred to the client.
Anything obvious I’m missing from my side?
Thanks for help.