How to synchronize the player spawning over the network?
I want to synchronize the spawning of the player characters over the network because I always run into this issuse:
I connect to the game with the first character and this one creates a RandomRoom.
Now I want to spawn in the second characterand this second character joins the Room that has been created by the first player.
BUT when I join with the second character, he can´t see the first character, which joined before him.
However the first character can see the second character that joined.
Here is the code that I use to spawn in the Characters:
I connect to the game with the first character and this one creates a RandomRoom.
Now I want to spawn in the second characterand this second character joins the Room that has been created by the first player.
BUT when I join with the second character, he can´t see the first character, which joined before him.
However the first character can see the second character that joined.
Here is the code that I use to spawn in the Characters:
using UnityEngine; using Photon.Pun; public class SpawnPlayerCharacter : MonoBehaviour { public static SpawnPlayerCharacter SPC; public GameObject playerPrefab; private void Start() { SpawnPlayer(); } public void SpawnPlayer() { playerPrefab = CharacterManager.CM.allCharacters[CharacterManager.CM.mySelectedCharacter]; //float randomX = Random.Range(+80f, -80f); //float randomZ = Random.Range(+80f, -80f); PhotonNetwork.Instantiate(playerPrefab.name, new Vector3(10f, 502f, 20f), Quaternion.identity); } }
0