@@ -33,6 +33,13 @@ public class NetworkConfig
3333 [ Tooltip ( "The Scenes that can be switched to by the server" ) ]
3434 public List < string > RegisteredScenes = new List < string > ( ) ;
3535 /// <summary>
36+ /// Whether or not runtime scene changes should be allowed and expected.
37+ /// If this is true, clients with different initial configurations will not worth together.
38+ /// </summary>
39+ [ Tooltip ( "Whether or not runtime scene changes should be allowed and expected.\n " +
40+ "If this is true, clients with different initial configurations will not worth together." ) ]
41+ public bool AllowRuntimeSceneChanges = false ;
42+ /// <summary>
3643 /// A list of spawnable prefabs
3744 /// </summary>
3845 [ Tooltip ( "The prefabs that can be spawned across the network" ) ]
@@ -233,6 +240,7 @@ public string ToBase64()
233240 writer . WriteBool ( RecycleNetworkIds ) ;
234241 writer . WriteSinglePacked ( NetworkIdRecycleDelay ) ;
235242 writer . WriteBool ( EnableNetworkedVar ) ;
243+ writer . WriteBool ( AllowRuntimeSceneChanges ) ;
236244 stream . PadStream ( ) ;
237245
238246 return Convert . ToBase64String ( stream . ToArray ( ) ) ;
@@ -280,6 +288,7 @@ public void FromBase64(string base64)
280288 config . RecycleNetworkIds = reader . ReadBool ( ) ;
281289 config . NetworkIdRecycleDelay = reader . ReadSinglePacked ( ) ;
282290 config . EnableNetworkedVar = reader . ReadBool ( ) ;
291+ config . AllowRuntimeSceneChanges = reader . ReadBool ( ) ;
283292 }
284293 }
285294 }
@@ -305,9 +314,12 @@ public ulong GetConfig(bool cache = true)
305314 writer . WriteUInt16Packed ( ProtocolVersion ) ;
306315 writer . WriteString ( MLAPIConstants . MLAPI_PROTOCOL_VERSION ) ;
307316
308- for ( int i = 0 ; i < RegisteredScenes . Count ; i ++ )
317+ if ( ! AllowRuntimeSceneChanges )
309318 {
310- writer . WriteString ( RegisteredScenes [ i ] ) ;
319+ for ( int i = 0 ; i < RegisteredScenes . Count ; i ++ )
320+ {
321+ writer . WriteString ( RegisteredScenes [ i ] ) ;
322+ }
311323 }
312324
313325 if ( ForceSamePrefabs )
0 commit comments