Search Unity

UNET: Spawning different player prefabs (SOLVED)

Discussion in 'UNet' started by lejean, Feb 23, 2016.

  1. rmsuhail

    rmsuhail

    Joined:
    Jan 5, 2014
    Posts:
    6
    guys the code posted by @lejean some how works , but the problem is when i use network start position for spawn points it doesn't work , can anyone suggest what's the issue, the network manager(custom) totally ignores spawn points
     
  2. lexon4eg

    lexon4eg

    Joined:
    Sep 11, 2017
    Posts:
    1
    Code (CSharp):
    1. Transform startPos = GetStartPosition();
    2.         if (selectedClass == 0)
    3.         {
    4.             GameObject player = Instantiate(_char1, startPos.position, startPos.rotation) as GameObject;
    5.             NetworkServer.AddPlayerForConnection(conn, player, playerControllerId);
    6.         }
    I do not know how true this is, but it works for me.
     
  3. romain1994

    romain1994

    Joined:
    Oct 23, 2018
    Posts:
    26
    hello sorry for my nooby question but where should i attach the script that @lejean mentioned? thank you in advance
     
  4. stjernerlever

    stjernerlever

    Joined:
    Oct 25, 2015
    Posts:
    10
    No one else getting this error?

    Assets\Scripts\NetworkCustom.cs(15,26): error CS0115: 'NetworkCustom.OnServerAddPlayer(NetworkConnection, short, NetworkReader)': no suitable method found to override
     
  5. unity_uRfcUeY_GZR57A

    unity_uRfcUeY_GZR57A

    Joined:
    Mar 14, 2019
    Posts:
    6
    @lejean What is in the "extraMessageReader.ReadMessage"