I’ve been having an issue where semi-regularly my client attempts to connect to my host but seems to partially fail. I’m currently using Netcode for GameObjects 1.9.1 and Unity 2022.3.10f1.
As far as I can tell, the client makes a connection and is seen by the host (NetworkManager.ConnectedClientsList.Count increases to reflect this), and on the client side it shows NetworkManager.IsApproved as being true, although it shows NetworkManager.IsConnectedClient as being false?
The documentation I could find on these was a little sparse and only seems to say that the difference between the two is that IsConnectedClient indicates that the client is also “Synchronized with the server” whatever that means? (I believe this is the correct documentation: Class NetworkManager | Netcode for GameObjects | 1.9.1 )
As far as I can tell these changes in connection status are purely the results of calling NetworkManager.Singleton.StartClient() in my StartClient() function, but there are is no actual events thrown to signify what the issues are? I’ve tried looking at OnClientDisconnectCallback, OnTransportFailure, ConnectionApprovalCallback, and OnConnectionEvent, but the first three don’t seem to trigger in any of my cases, and OnConnectionEvent seems to give very little information (it fires a “client connected” event on a complete success and does nothing on a partial success).
In terms of the actual scenes, it basically acts as if the client didn’t connect, and the scenemanager fails to sync the client’s scene to the host’s scene, although any newly spawned networkObjects appear in the client’s scene (still on the main menu instead of in the loaded game scene).
I have the code below for my HostScene() and StartClient() code. None of the exceptions are being hit and it doesn’t seem consistent how frequently/when the partial failures are occurring. I’ve had it connect fine as many as 6 times in a row, and I’ve had it fail to connect correctly as many as probably 5 or so times in a row. I’ve also had it alternate 1 for 1 as many as 3 or 4 times. I have primarily tested using one unity editor and one standalone build on the same PC. I have also tested with two standalone builds on the same PC (all windows).
public async void HostScene(string sceneName)
{
Allocation allocation;
status.currentAwait = "Waiting for host allocation";
try
{
allocation = await RelayService.Instance.CreateAllocationAsync(4);
}
catch (Exception e)
{
Debug.Log($"Failed to create allocation while hosting scene. Caught exception: {e}");
return;
}
status.currentAwait = "Waiting for join code";
try
{
FindObjectOfType<PersistentData>().JoinCode = await RelayService.Instance.GetJoinCodeAsync(allocation.AllocationId);
}
catch (Exception e)
{
Debug.Log($"Failed to get join code while hosting scene. Caught exception: {e}");
}
status.currentAwait = "";
RelayServerData servDat = new RelayServerData(allocation, "dtls");
NetworkManager.Singleton.GetComponent<UnityTransport>().SetRelayServerData(servDat);
NetworkManager.Singleton.StartHost();
NetworkManager.Singleton.SceneManager.LoadScene(sceneName, LoadSceneMode.Single);
}
public async void StartClient(string joinCode)
{
JoinAllocation allocation;
lastUsedJoinCode = joinCode;
status.currentAwait = "Waiting to join";
try
{
allocation = await RelayService.Instance.JoinAllocationAsync(joinCode);
}
catch (Exception e)
{
Debug.Log($"Failed to join allocation as client w/ joincode {joinCode}. Exception caught: {e}");
return;
}
status.currentAwait = "";
RelayServerData servDat = new RelayServerData(allocation, "dtls");
NetworkManager.Singleton.GetComponent<UnityTransport>().SetRelayServerData(servDat);
NetworkManager.Singleton.StartClient();
}
When this occurs I’m getting this warning on the client side a handful of times with slightly different values:
And on the host side I’m getting this error:
Which both seem to me like errors based off the fact that the client isn’t properly loading the host’s scene? Although I’m a bit unclear here.

