File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
Assets/BossRoom/Scripts/Shared/Net/ConnectionManagement Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -182,17 +182,14 @@ private IEnumerator TryToReconnect()
182
182
nbTries ++ ;
183
183
}
184
184
185
- if ( ! NetworkManager . Singleton . IsConnectedClient )
185
+ // If the coroutine has not been stopped before this, it means we failed to connect during all attempts
186
+ Debug . Log ( "All tries failed, returning to main menu" ) ;
187
+ NetworkManager . Singleton . Shutdown ( ) ;
188
+ SceneLoaderWrapper . Instance . LoadScene ( "MainMenu" ) ;
189
+ if ( ! DisconnectReason . HasTransitionReason )
186
190
{
187
- Debug . Log ( "All tries failed, returning to main menu" ) ;
188
- SceneLoaderWrapper . Instance . LoadScene ( "MainMenu" ) ;
189
- if ( ! DisconnectReason . HasTransitionReason )
190
- {
191
- DisconnectReason . SetDisconnectReason ( ConnectStatus . GenericDisconnect ) ;
192
- }
193
-
191
+ DisconnectReason . SetDisconnectReason ( ConnectStatus . GenericDisconnect ) ;
194
192
}
195
- NetworkManager . Singleton . Shutdown ( ) ;
196
193
m_TryToReconnectCoroutine = null ;
197
194
m_ConnectStatusPub . Publish ( DisconnectReason . Reason ) ;
198
195
}
You can’t perform that action at this time.
0 commit comments