Open makcimbx opened 1 year ago
Just in case. @FirstGearGames
Are you calling it immediately after StartConnection or polling it continuously and it still returning Stopped even though started?
I use this code for Tugboat, Unity and Yak transports. UniTask checks the given condition every frame. But it is not working for Steam transport.
public virtual async UniTask StartClient()
{
multipass.StartConnection(false, transportIndex);
await UniTask.WaitUntil(() =>
multipass.GetConnectionState(false, transportIndex) == LocalConnectionState.Started);
}
I end up having to use this code to check that the client has connected on Steam transport.
public override async UniTask StartClient()
{
var completionSource = new UniTaskCompletionSource();
networkManager.ClientManager.OnClientConnectionState += OnClientConnectionState;
multipass.StartConnection(false);
await completionSource.Task;
void OnClientConnectionState(ClientConnectionStateArgs args)
{
if (args.ConnectionState != LocalConnectionState.Started) return;
networkManager.ClientManager.OnClientConnectionState -= OnClientConnectionState;
completionSource.TrySetResult();
}
}
I didn't see anything in the code that stood out. I'll have to run the transport to tests.
Hi, I am using GetConnectionState after StartConnection for the client to monitor the connection status and it always returns Stopped. If you start the server, it works fine. Same problem with Facepunch transporter. UnityTransporter and Tugboat work fine with this method on client connection startup.