Hello,
I’m trying to get co-op working with unity but i got a little problem while spawning new players.
With the first script i can’t get the new player see the old player, i understand why it’s not doing it. But when i do it the second way, I get every time someone joins and spawns, the olders also get a new character controller.
there is the first way (that is obvious for me why it doesn’t work):
void Start()
{
Debug.Log("Spawning the player locally");
Spawnplayer();
}
void Spawnplayer()
{
Debug.Log("Spawing another player");
Network.Instantiate(PlayerPrefab, transform.position, transform.rotation, 0);
}
The other way:
void Start()
{
Debug.Log("Spawning the player locally");
//Spawnplayer();
networkView.RPC("Spawnplayer", RPCMode.AllBuffered);
}
[RPC]
void Spawnplayer()
{
Debug.Log("Spawing another player");
Network.Instantiate(PlayerPrefab, transform.position, transform.rotation, 0);
//Instantiate(PlayerPrefab, transform.position, transform.rotation);
}