Search Unity

OnLobbyServerCreateGamePlayer Never Calls

Discussion in 'Multiplayer' started by Nigey, Mar 19, 2018.

  1. Nigey

    Nigey

    Joined:
    Sep 29, 2013
    Posts:
    1,129
    Hi Guys,

    Simple problem. OnLobbyServerCreateGamePlayer is not being called when loading the Play Scene from the Network Lobby Manager and Network Manager HUD. OnLobbyServerCreateLobbyPlayer IS being called, just not OnLobbyServerCreateGamePlayer. Even though both prefabs have been added to the Network Lobby Manager inspector.

    In the game itself, very simple. I select LAN Host(H), and in the 'Players' sub-menu, I select 'START', which loads the new scene, but without the Game Player Prefab.



    The only script I have changing the defaults is this:

    Code (CSharp):
    1. public class LobbyManager : NetworkLobbyManager
    2.     {
    3.         public override GameObject OnLobbyServerCreateGamePlayer(NetworkConnection conn, short playerControllerId)
    4.         {
    5.             Debug.Log("<b>CALLED OnLobbyServerCreateGamePlayer</b>");
    6.             return null;
    7.         }
    8.  
    9.         public override GameObject OnLobbyServerCreateLobbyPlayer(NetworkConnection conn, short playerControllerId)
    10.         {
    11.             Debug.Log("<b>CALLED OnLobbyServerCreateLobbyPlayer</b>");
    12.             return null;
    13.         }
    14.     }
    Only the Debug.Log("<b>CALLED OnLobbyServerCreateLobbyPlayer</b>"); is being called.

    Can anyone help?

    I've seen this https://forum.unity.com/threads/lobbyplayer-to-gameplayer-networklobbymanager.349614/ and that doesn't seem to make any difference.

    Thanks!
     
    Last edited: Mar 19, 2018
  2. Nigey

    Nigey

    Joined:
    Sep 29, 2013
    Posts:
    1,129
    Found the answer. LobbyManager has a DontDestroyOnLoad call, which only works when it's the root of an object hierarchy. So it can't go in a '_root' gameObject or something. Anyways, all working now.
     
  3. Abdul_M

    Abdul_M

    Joined:
    Feb 17, 2018
    Posts:
    11
    how did you fix the issue???
    @Nigey