I have a game where a server and many different clients can connect. The network system is set up and right now we can have many players playing the game. I got alot of help from the unity car racing tutorial. My is question is the following I have many different player prefabs( mainly the difference is the model), however right now every client that connects gets the same player prefab. How can I set it up such that each client that connects to the server gets a different player prefab. For example lets say I have 5 prefabs and the game has a total of 5 players. How can the client know that this prefab was already chose by a different client. Mianly what Im trying to do is that these 5 players have the 5 different prefabs.
var playerPrefab : Transform;
var playerPrefab1 : Transform;
var playerPrefab2 : Transform;
var playerPrefab3 : Transform;
var playerPrefab4 : Transform;
function OnNetworkLoadedLevel ()
{
// Randomize starting location
var pos : Vector3;
pos.x = 0;
pos.y = 0;
pos.z = 0;
Network.Instantiate(playerPrefab, pos, transform.rotation, 0);
}
function OnPlayerDisconnected (player : NetworkPlayer)
{
Debug.Log("Server destroying player");
Network.RemoveRPCs(player, 0);
Network.DestroyPlayerObjects(player);
}