Check out example codes for "custom player spawner mirror". It will help you in understanding the concepts better.

Code Example 1

//You need to create a message handler
public class MMONetworkManager : NetworkManager
    public override void OnStartServer()


    public override void OnClientConnect(NetworkConnection conn)

        // you can send the message here, or wherever else you want
        CreateMMOCharacterMessage characterMessage = new CreateMMOCharacterMessage
            race = Race.Elvish,
            name = "Joe Gaba Gaba",
            hairColor =,
            eyeColor =


    void OnCreateCharacter(NetworkConnection conn, CreateMMOCharacterMessage message)
        // playerPrefab is the one assigned in the inspector in Network
        // Manager but you can use different prefabs per race for example
        GameObject gameobject = Instantiate(playerPrefab);

        // Apply data from the message however appropriate for your game
        // Typically Player would be a component you write with syncvars or properties
        Player player = gameobject.GetComponent<Player>();
        player.hairColor = message.hairColor;
        player.eyeColor = message.eyeColor; =;
        player.race = message.race;

        // call this to use this gameobject as the primary controller
        NetworkServer.AddPlayerForConnection(conn, gameobject);

Learn ReactJs, React Native from