@@ -80,8 +80,8 @@ public Dictionary<int, NetworkedClient> ConnectedClients
8080 }
8181 }
8282 internal HashSet < int > pendingClients ;
83- internal bool isServer ;
84- internal bool isClient ;
83+ internal bool _isServer ;
84+ internal bool _isClient ;
8585 /// <summary>
8686 /// Gets if we are running as host
8787 /// </summary>
@@ -92,6 +92,23 @@ public bool isHost
9292 return isServer && isClient ;
9393 }
9494 }
95+
96+ public bool isClient
97+ {
98+ get
99+ {
100+ return _isClient ;
101+ }
102+ }
103+
104+ public bool isServer
105+ {
106+ get
107+ {
108+ return _isServer ;
109+ }
110+ }
111+
95112 private bool isListening ;
96113 private byte [ ] messageBuffer ;
97114 internal int serverClientId ;
@@ -192,6 +209,8 @@ private ConnectionConfig Init(NetworkingConfiguration netConfig)
192209 {
193210 uint networkId = SpawnManager . GetNetworkObjectId ( ) ;
194211 SpawnManager . spawnedObjects . Add ( networkId , sceneObjects [ i ] ) ;
212+ sceneObjects [ i ] . _isSpawned = true ;
213+ sceneObjects [ i ] . sceneObject = true ;
195214 }
196215 }
197216
@@ -287,8 +306,8 @@ public void StartServer(NetworkingConfiguration netConfig)
287306 }
288307 HostTopology hostTopology = new HostTopology ( cConfig , NetworkConfig . MaxConnections ) ;
289308 hostId = NetworkTransport . AddHost ( hostTopology , NetworkConfig . Port ) ;
290- isServer = true ;
291- isClient = false ;
309+ _isServer = true ;
310+ _isClient = false ;
292311 isListening = true ;
293312
294313 if ( OnServerStarted != null )
@@ -305,8 +324,8 @@ public void StartClient(NetworkingConfiguration netConfig)
305324 HostTopology hostTopology = new HostTopology ( cConfig , NetworkConfig . MaxConnections ) ;
306325 hostId = NetworkTransport . AddHost ( hostTopology , 0 , null ) ;
307326
308- isServer = false ;
309- isClient = true ;
327+ _isServer = false ;
328+ _isClient = true ;
310329 isListening = true ;
311330 serverClientId = NetworkTransport . Connect ( hostId , NetworkConfig . Address , NetworkConfig . Port , 0 , out error ) ;
312331 }
@@ -334,6 +353,7 @@ public void StopServer()
334353 NetworkTransport . Disconnect ( hostId , clientId , out error ) ;
335354 }
336355 }
356+ _isServer = false ;
337357 Shutdown ( ) ;
338358 }
339359
@@ -342,6 +362,8 @@ public void StopServer()
342362 /// </summary>
343363 public void StopHost ( )
344364 {
365+ _isClient = false ;
366+ _isServer = false ;
345367 StopServer ( ) ;
346368 //We don't stop client since we dont actually have a transport connection to our own host. We just handle host messages directly in the MLAPI
347369 }
@@ -351,6 +373,7 @@ public void StopHost()
351373 /// </summary>
352374 public void StopClient ( )
353375 {
376+ _isClient = false ;
354377 NetworkTransport . Disconnect ( hostId , serverClientId , out error ) ;
355378 Shutdown ( ) ;
356379 }
@@ -371,8 +394,8 @@ public void StartHost(NetworkingConfiguration netConfig)
371394 }
372395 HostTopology hostTopology = new HostTopology ( cConfig , NetworkConfig . MaxConnections ) ;
373396 hostId = NetworkTransport . AddHost ( hostTopology , NetworkConfig . Port , null ) ;
374- isServer = true ;
375- isClient = true ;
397+ _isServer = true ;
398+ _isClient = true ;
376399 isListening = true ;
377400 connectedClients . Add ( - 1 , new NetworkedClient ( ) { ClientId = - 1 } ) ;
378401 if ( NetworkConfig . HandleObjectSpawning )
@@ -408,8 +431,8 @@ private void OnDestroy()
408431 private void Shutdown ( )
409432 {
410433 isListening = false ;
411- isClient = false ;
412- isServer = false ;
434+ _isClient = false ;
435+ _isServer = false ;
413436 NetworkTransport . Shutdown ( ) ;
414437 }
415438
@@ -752,7 +775,7 @@ private void HandleIncomingData(int clientId, byte[] data, int channelId)
752775 }
753776 if ( NetworkConfig . HandleObjectSpawning )
754777 {
755- SpawnManager . DestroyUnspawnedObjects ( ) ;
778+ SpawnManager . DestroySceneObjects ( ) ;
756779 int objectCount = messageReader . ReadInt32 ( ) ;
757780 for ( int i = 0 ; i < objectCount ; i ++ )
758781 {
0 commit comments