Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

Connection already ready when adding players to Host

$
0
0
Working on a game which will have three different game modes, two which are single device and a third which allows access through the network. In order to simplify the game code its been structured to have a single scene with networking identities on all relevant objects. In doing so, I'm setting up a custom NetworkLobbyManager which can be used regardless of game mode. The error I'm seeing is when attempting to add local players, specifically Lobby Players, to a started host. The process flow is below: public class MyLobbyManager : NetworkLobbyManager { public void StartSingleHost() { maxConnections = 1; maxPlayers = 5; maxPlayersPerConnection = 5; autoCreatePlayer = false; StartHost(); } } This configures and starts the host. On the subsequent frame, I'm attempting to add two local device players via: MyLobbyManager lobbyMgr = FindObjectOfType(); lobbyMgr.TryToAddPlayer(); This performs as expected; however Unity throws the error: "**A connection has already been set as ready. There can only be one.**" I've tried with several different approaches: - ClientScene.AddPlayer ~ Same error - NetworkServer.AddPlayerForConnection ~Different error, I don't recall the exact messaging My original attempt is what is currently listed. After no results I used .NET Reflector to inspect how the NetworkLobbyManger had this setup. The key areas of interest in the NetworkLobbyManager are: public class NetworkLobbyManager : NetworkManager { public override void OnStartServer() { if (this.lobbySlots.Length == 0) this.lobbySlots = new NetworkLobbyPlayer[this.maxPlayers]; this.OnLobbyStartServer(); } public virtual void OnLobbyStartServer() {} public override void OnStartHost(){ this.OnLobbyStartHost(); } public virtual void OnLobbyStartHost() { } private void OnGUI() { ... this.TryToAddPlayer(); } } The [reference][1] I found regarding this issue showed that a simple check is being made to see if the connection already exists and then exists, with an error logged, if that is the case. As queried in the reference and based upon my own inspection, it doesn't look like this impacts anything; however, any errors in the log bother me. Inspecting further it does look as if **StartHost()** calls **ConnectLocalClient()** but tracing that is a veritable rats nest. Is there a preferred method of starting a local host or connecting local players? Considering an implementation using a NetworkLobbyManager and the NetworkMangerHUD don't yield the same results when adding players I can't imagine this is a defect within Unity, unless there's something within the NetworkLobbyManager which is not available in the subclass. Now that I think of it, I did notice a similar, unresolved, issue when attempting to extend the NetworkLobbyPlayer. Any insight into the matter would be greatly appreciated. [1]: http://answers.unity3d.com/questions/991552/unet-a-connection-has-already-been-set-as-ready-th.html

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>