We are attempting to make a 2D multiplayer game using Photon Fusion and Unity 2021.3.5f1.
We have setup the fusion app and framework based on this tutorial on youtube:
however when the server is started all is well, but when the clients join the server can see them but the clients are all being spawned at 0,0 where on the server they’re at 35,40. Does anyone have any idea why the clients position would not be syncing up? 0,0 seems to me the server isnt sending the players location across hence the null spawnpoint.
Spawn code inside Spawner.cs which is tied to the NetworkRunner prefab as shown in the tutorial:
public void OnPlayerJoined(NetworkRunner runner, PlayerRef player)
{
NetworkPlayer networkPlayer;
if(runner.IsServer)
{
networkPlayer = runner.Spawn(playerPrefab, Utils.GetRandomSpawnPoint(), Quaternion.identity, player);
}
}
NetworkPlayer code:
public override void Spawned()
{
if (Object.HasInputAuthority)
{
Local = this;
Debug.Log("Spawned local player");
}
else Debug.Log("Spawned remote player");
Debug.Log(this.transform.position);
}
Thanks