- Home /
Dedicated server lobby problem
I am trying to make a dedicated server for my game. (testing in the tanks multiplayer first).But I am having problems with the lobby on the servers side. When the server is running and a player connects I want to show on the server that that player is connected. On the client side the player is showing correctly and on the dedicated server the player is not showing correctly. On the client side the Prefab is automaticly updating and on the server side not. The code below is to Instantiate the prefab.
public override GameObject OnLobbyServerCreateLobbyPlayer(NetworkConnection conn, short playerControllerId)
{
base.OnLobbyServerCreateLobbyPlayer (conn, playerControllerId);
GameObject obj = Instantiate(lobbyPlayerPrefab.gameObject) as GameObject;
LobbyPlayer newPlayer = obj.GetComponent<LobbyPlayer>();
newPlayer.ToggleJoinButton(numPlayers + 1 >= minPlayers);
for (int i = 0; i < lobbySlots.Length; ++i)
{
LobbyPlayer p = lobbySlots[i] as LobbyPlayer;
if (p != null)
{
p.RpcUpdateRemoveButton();
p.ToggleJoinButton(numPlayers + 1 >= minPlayers);
}
}
obj.transform.SetParent(playerListContentTransform, false);
return obj;
}
When the prefab is Instantiated the script that is attached to the prefab gets updated. But the problem is that it doesn't get executed properly. Can somebody help me?![alt text][2] [2]: /storage/temp/110346-schermafbeelding-2018-01-30-om-032453.png
Your answer
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
How to "network.instantiate" an object only in a certain group of clients. 0 Answers
Networking: Standalone Simulation Server 0 Answers
LobbyManager / NetworkManager doesn't reset properly 4 Answers
Unity dedicated server for validating data and handling data from many clients 2 Answers