Unity 5.4 - NetworkLobbyManager can't accept new connection [hostId: -1 connectionId: 0 isReady: False channel count: 0], not in lobby and game already in progress.
So, I'm trying to make my own HUD for the NetworkLobbyManager in Unity 5.4. Of course, they've done all kinds of changes to networking, so I'm having a hard time finding a solution to this error. This is my current code, I think I'm doing things right, but I'm not entirely sure.
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
using System.Collections;
public class MainMenuBehavior : MonoBehaviour
{
public NetworkLobbyManager mgr;
public GameObject MainMenuPanel;
public GameObject CreateGamePanel;
public GameObject JoinGamePanel;
public GameObject SettingsPanel;
public GameObject CreditsPanel;
private string PlayerName;
private string MatchName;
private string MatchPassword;
public bool isLan = false;
void Awake()
{
mgr.StartMatchMaker();
}
/***
* Begin Button Network Functionality Code
***/
public void OnHostLAN()
{
isLan = true;
}
public void OnHostMatchMaker()
{
isLan = false;
}
// Creates A Lobby
public void OnCreateLobby()
{
if (isLan)
{
mgr.matchMaker.CreateMatch("Test Game LAN", 8, true, "", "public address", "private address", 0, 0, mgr.OnMatchCreate);
// TODO: Setup Connection To LAN Lobby
}
else
{
mgr.matchMaker.CreateMatch("Test Game Matched", 8, true, "", "", "", 0, 0, mgr.OnMatchCreate);
// TODO: Setup Connection To Non-LAN Lobby
}
}
// This Attempts to Connect To A Lobby
public void OnConnectToLobby()
{
}
// This Refreshes The List Of Lobbies
public void OnRefreshGames()
{
}
/***
* End Button Network Functionality Code
***/
/***
* Begin GUI Controller Code
***/
public void OnCreateMultiplayerMenu()
{
if (MainMenuPanel != null)
MainMenuPanel.SetActive(false);
if (CreateGamePanel != null)
CreateGamePanel.SetActive(true);
else
MainMenuPanel.SetActive(true);
if (JoinGamePanel != null)
JoinGamePanel.SetActive(false);
if (SettingsPanel != null)
SettingsPanel.SetActive(false);
if (CreditsPanel != null)
CreditsPanel.SetActive(false);
}
public void OnJoinMultiplayerMenu()
{
if (MainMenuPanel != null)
MainMenuPanel.SetActive(false);
if (CreateGamePanel != null)
CreateGamePanel.SetActive(false);
if (JoinGamePanel != null)
JoinGamePanel.SetActive(true);
else
MainMenuPanel.SetActive(true);
if (SettingsPanel != null)
SettingsPanel.SetActive(false);
if (CreditsPanel != null)
CreditsPanel.SetActive(false);
}
public void OnSettingsMenu()
{
if (MainMenuPanel != null)
MainMenuPanel.SetActive(false);
if (CreateGamePanel != null)
CreateGamePanel.SetActive(false);
if (JoinGamePanel != null)
JoinGamePanel.SetActive(false);
if (SettingsPanel != null)
SettingsPanel.SetActive(true);
else
MainMenuPanel.SetActive(true);
if (CreditsPanel != null)
CreditsPanel.SetActive(false);
}
public void OnCreditsMenu()
{
if (MainMenuPanel != null)
MainMenuPanel.SetActive(false);
if (CreateGamePanel != null)
CreateGamePanel.SetActive(false);
if (JoinGamePanel != null)
JoinGamePanel.SetActive(false);
if (SettingsPanel != null)
SettingsPanel.SetActive(false);
if (CreditsPanel != null)
CreditsPanel.SetActive(true);
else
MainMenuPanel.SetActive(true);
}
public void OnQuitGameMenu()
{
}
public void OnReturnToMainMenu()
{
mgr.StopMatchMaker();
if (CreateGamePanel != null)
CreateGamePanel.SetActive(false);
if (JoinGamePanel != null)
JoinGamePanel.SetActive(false);
if (SettingsPanel != null)
SettingsPanel.SetActive(false);
if (CreditsPanel != null)
CreditsPanel.SetActive(false);
if (MainMenuPanel != null)
MainMenuPanel.SetActive(true);
}
/***
* END GUI Controller Code
***/
}
If anyone knows what I'm doing wrong, I'd appreciate a solution. I've tried searching the forums and answers, even Google, but haven't found anything similar. I really want to get matchmaking lobbies and LAN lobbies up and running.
Your answer
Follow this Question
Related Questions
unity networking not working 0 Answers
how to transfer variables from lobby player to game player on client 0 Answers
My Brain is fogged: How do I move a networked object with user input 0 Answers
How to create a custom network lobby manager with unet? 2 Answers
How to fix error CS0103 Cannot implicitly covert type 'bool' to 'string' 1 Answer