NetWork: Random Player

HI, I try to spawn a different playerprefab each time the client connect the server. So, basicly, I try this just to teste if the prefab have changed befor script the random part. ex:

using UnityEngine.
using UnityEngine.Networking;
public class PlayerPrefManager : NetworkManager {

public GameObject playerPrefab;
public GameObject playerPrefab2;

public override void 

OnServerReady(NetworkConnection conn)



But nothing happen. How can I rosolve this whitout change anything to my playerprefab because it is done.

Can’t you make an array of GameObjects and then use Random.range(0,array.Length) to select the index and then use the override that @TheSorm posted to spawn that specific prefab

You can just override this methode:

// called when a new player is added for a client
public virtual void OnServerAddPlayer(NetworkConnection conn, short playerControllerId)
    var player = (GameObject)GameObject.Instantiate(playerPrefab, playerSpawnPos, Quaternion.identity);
    NetworkServer.AddPlayerForConnection(conn, player, playerControllerId);

And put your different players randomly.