Multiple player prefabs in the network manager?

I’m currently working on a project that allows players to choose their player model (i.e. car model), but Unity’s new Network Manager only allows for a single ‘Player Prefab’ slot.

Initially, I wrote a script that put all player models into an array and I called each one when I switched player models using UI. However, it seems that you can not dynamically switch the Network Manager’s player prefab in code.

Next, I tried the terribly long and inefficient method of creating a single prefab containing every player model, and I would disable all other player models that weren’t being used. This worked as well, but I could not find a way to save these enabled/disabled choices to the prefab to be used in the Network Manager.

So I’m curious if anyone else has run into this problem or if anyone has found a fix. Trust me, I’m willing to try anything at this point. Thanks a ton!

Hey man, I have a solution for you.

using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Networking.NetworkSystem;

public class NetworkController : NetworkManager {
    public Transform spawnPosition;   
    public int curPlayer;

    //Called on client when connect
    public override void OnClientConnect(NetworkConnection conn) {       

        // Create message to set the player
        IntegerMessage msg = new IntegerMessage(curPlayer);      
        // Call Add player and pass the message
        ClientScene.AddPlayer(conn,0, msg);
// Server
    public override void OnServerAddPlayer(NetworkConnection conn, short playerControllerId, NetworkReader extraMessageReader ) { 

        // Read client message and receive index
        if (extraMessageReader) {
            var stream = extraMessageReader.ReadMessage<IntegerMessage> ();
            curPlayer = stream.value;
        //Select the prefab from the spawnable objects list
        var playerPrefab = spawnPrefabs[curPlayer];       
        // Create player object with prefab
        var player = Instantiate(playerPrefab, spawnPosition.position, Quaternion.identity) as GameObject;        
        // Add player object for connection
        NetworkServer.AddPlayerForConnection(conn, player, playerControllerId);

Please refer video once

I know it’s an old post but @Tubel answer really helped me. I have 2 types of prefabs, a male and female so I need to be able to spawn either one from a login script. I have a custom network manager with overrides based on Tubel’s answer, I assign curPlayer via the login script (which is only on the local clients) this in turn tells the server’s network manager which prefab from the spawnable list to use for the connecting player.

I have the same problem but this not works for me, another idea?