Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How to use multiple Player Prefab ?

Discussion in 'Multiplayer' started by PhiKirax, Aug 9, 2016.

  1. PhiKirax

    PhiKirax

    Joined:
    Feb 8, 2016
    Posts:
    10
    Hello,

    I'm currently making video game for IPhone and android, I have a two type of prefab player in network manager. Since multiple day, searching tuto for use multiple player prefab, (first if server, second if client) but i'm not find correctly tuto for Unity 5.3

    Have you ?

    I begin to despair :(

    Sorry if my english is not perfect i'm french :/
     
  2. DanglingNeuron

    DanglingNeuron

    Joined:
    Dec 4, 2012
    Posts:
    37
    you can use one player prefab but then check if its server or client and change properties or add different child objects
     
  3. Twitwi

    Twitwi

    Joined:
    Apr 11, 2012
    Posts:
    22
    I'll expand a little on what DanglingNeuron said

    Create a new component and make it inherit from NetworkManager (or NetworkLobbyManager) and replace your current NetworkManager in the scene with that.

    Add 2 public (or serialized private) GameObject fields to the NetworkManager.

    Override the OnServerAddPlayer method and create your spawning logic there.

    Take a look at what you are overriding here.
     
  4. PhiKirax

    PhiKirax

    Joined:
    Feb 8, 2016
    Posts:
    10