Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 39 additions & 5 deletions com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,17 @@ public bool StartServer()
}
ConnectionManager.LocalClient.ClientId = ServerClientId;

Initialize(true);
try
{
Initialize(true);
}
catch (Exception ex)
{
Debug.LogException(ex);
// Always shutdown to assure everything is cleaned up
ShutdownInternal();
return false;
}

try
{
Expand All @@ -1342,11 +1352,13 @@ public bool StartServer()

ConnectionManager.TransportFailureEventHandler(true);
}
catch (Exception)
catch (Exception ex)
{
Debug.LogException(ex);
// Always shutdown to assure everything is cleaned up
ShutdownInternal();
ConnectionManager.LocalClient.SetRole(false, false);
IsListening = false;
throw;
}

return IsListening;
Expand All @@ -1373,7 +1385,16 @@ public bool StartClient()
return false;
}

Initialize(false);
try
{
Initialize(false);
}
catch (Exception ex)
{
Debug.LogException(ex);
ShutdownInternal();
return false;
}

try
{
Expand Down Expand Up @@ -1419,7 +1440,18 @@ public bool StartHost()
return false;
}

Initialize(true);
try
{
Initialize(true);
}
catch (Exception ex)
{
Debug.LogException(ex);
// Always shutdown to assure everything is cleaned up
ShutdownInternal();
return false;
}

try
{
IsListening = NetworkConfig.NetworkTransport.StartServer();
Expand All @@ -1437,6 +1469,8 @@ public bool StartHost()
catch (Exception ex)
{
Debug.LogException(ex);
// Always shutdown to assure everything is cleaned up
ShutdownInternal();
ConnectionManager.LocalClient.SetRole(false, false);
IsListening = false;
}
Expand Down