File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,12 @@ int FindLobbyPlayerIdx(ulong clientId)
149
149
/// </summary>
150
150
void CloseLobbyIfReady ( )
151
151
{
152
+ // If dedicated server, leave char select open if there's no one left
153
+ if ( DedicatedServerUtilities . IsServerBuildTarget && CharSelectData . LobbyPlayers . Count == 0 )
154
+ {
155
+ return ;
156
+ }
157
+
152
158
foreach ( CharSelectData . LobbyPlayerState playerInfo in CharSelectData . LobbyPlayers )
153
159
{
154
160
if ( playerInfo . SeatState != CharSelectData . SeatState . LockedIn )
@@ -162,6 +168,11 @@ void CloseLobbyIfReady()
162
168
SaveLobbyResults ( ) ;
163
169
164
170
// Delay a few seconds to give the UI time to react, then switch scenes
171
+ IEnumerator WaitToEndLobby ( )
172
+ {
173
+ yield return new WaitForSeconds ( 3 ) ;
174
+ SceneLoaderWrapper . Instance . LoadScene ( SceneNames . BossRoom , useNetworkSceneManager : true ) ;
175
+ }
165
176
m_WaitToEndLobbyCoroutine = StartCoroutine ( WaitToEndLobby ( ) ) ;
166
177
}
167
178
@@ -193,11 +204,7 @@ void SaveLobbyResults()
193
204
}
194
205
}
195
206
196
- IEnumerator WaitToEndLobby ( )
197
- {
198
- yield return new WaitForSeconds ( 3 ) ;
199
- SceneLoaderWrapper . Instance . LoadScene ( SceneNames . BossRoom , useNetworkSceneManager : true ) ;
200
- }
207
+
201
208
202
209
public void OnNetworkDespawn ( )
203
210
{
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ void RemovePersistentPlayer()
75
75
if ( IsServer )
76
76
{
77
77
var sessionPlayerData = SessionManager < SessionPlayerData > . Instance . GetPlayerData ( OwnerClientId ) ;
78
- if ( sessionPlayerData . HasValue )
78
+ if ( sessionPlayerData . HasValue ) // it's possible no session has started yet (for ex when in character select)
79
79
{
80
80
var playerData = sessionPlayerData . Value ;
81
81
playerData . PlayerName = m_NetworkNameState . Name . Value ;
You can’t perform that action at this time.
0 commit comments