@@ -80,8 +80,8 @@ public Dictionary<int, NetworkedClient> ConnectedClients
80
80
}
81
81
}
82
82
internal HashSet < int > pendingClients ;
83
- internal bool isServer ;
84
- internal bool isClient ;
83
+ internal bool _isServer ;
84
+ internal bool _isClient ;
85
85
/// <summary>
86
86
/// Gets if we are running as host
87
87
/// </summary>
@@ -92,6 +92,23 @@ public bool isHost
92
92
return isServer && isClient ;
93
93
}
94
94
}
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
+
95
112
private bool isListening ;
96
113
private byte [ ] messageBuffer ;
97
114
internal int serverClientId ;
@@ -192,6 +209,8 @@ private ConnectionConfig Init(NetworkingConfiguration netConfig)
192
209
{
193
210
uint networkId = SpawnManager . GetNetworkObjectId ( ) ;
194
211
SpawnManager . spawnedObjects . Add ( networkId , sceneObjects [ i ] ) ;
212
+ sceneObjects [ i ] . _isSpawned = true ;
213
+ sceneObjects [ i ] . sceneObject = true ;
195
214
}
196
215
}
197
216
@@ -287,8 +306,8 @@ public void StartServer(NetworkingConfiguration netConfig)
287
306
}
288
307
HostTopology hostTopology = new HostTopology ( cConfig , NetworkConfig . MaxConnections ) ;
289
308
hostId = NetworkTransport . AddHost ( hostTopology , NetworkConfig . Port ) ;
290
- isServer = true ;
291
- isClient = false ;
309
+ _isServer = true ;
310
+ _isClient = false ;
292
311
isListening = true ;
293
312
294
313
if ( OnServerStarted != null )
@@ -305,8 +324,8 @@ public void StartClient(NetworkingConfiguration netConfig)
305
324
HostTopology hostTopology = new HostTopology ( cConfig , NetworkConfig . MaxConnections ) ;
306
325
hostId = NetworkTransport . AddHost ( hostTopology , 0 , null ) ;
307
326
308
- isServer = false ;
309
- isClient = true ;
327
+ _isServer = false ;
328
+ _isClient = true ;
310
329
isListening = true ;
311
330
serverClientId = NetworkTransport . Connect ( hostId , NetworkConfig . Address , NetworkConfig . Port , 0 , out error ) ;
312
331
}
@@ -334,6 +353,7 @@ public void StopServer()
334
353
NetworkTransport . Disconnect ( hostId , clientId , out error ) ;
335
354
}
336
355
}
356
+ _isServer = false ;
337
357
Shutdown ( ) ;
338
358
}
339
359
@@ -342,6 +362,8 @@ public void StopServer()
342
362
/// </summary>
343
363
public void StopHost ( )
344
364
{
365
+ _isClient = false ;
366
+ _isServer = false ;
345
367
StopServer ( ) ;
346
368
//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
347
369
}
@@ -351,6 +373,7 @@ public void StopHost()
351
373
/// </summary>
352
374
public void StopClient ( )
353
375
{
376
+ _isClient = false ;
354
377
NetworkTransport . Disconnect ( hostId , serverClientId , out error ) ;
355
378
Shutdown ( ) ;
356
379
}
@@ -371,8 +394,8 @@ public void StartHost(NetworkingConfiguration netConfig)
371
394
}
372
395
HostTopology hostTopology = new HostTopology ( cConfig , NetworkConfig . MaxConnections ) ;
373
396
hostId = NetworkTransport . AddHost ( hostTopology , NetworkConfig . Port , null ) ;
374
- isServer = true ;
375
- isClient = true ;
397
+ _isServer = true ;
398
+ _isClient = true ;
376
399
isListening = true ;
377
400
connectedClients . Add ( - 1 , new NetworkedClient ( ) { ClientId = - 1 } ) ;
378
401
if ( NetworkConfig . HandleObjectSpawning )
@@ -408,8 +431,8 @@ private void OnDestroy()
408
431
private void Shutdown ( )
409
432
{
410
433
isListening = false ;
411
- isClient = false ;
412
- isServer = false ;
434
+ _isClient = false ;
435
+ _isServer = false ;
413
436
NetworkTransport . Shutdown ( ) ;
414
437
}
415
438
@@ -752,7 +775,7 @@ private void HandleIncomingData(int clientId, byte[] data, int channelId)
752
775
}
753
776
if ( NetworkConfig . HandleObjectSpawning )
754
777
{
755
- SpawnManager . DestroyUnspawnedObjects ( ) ;
778
+ SpawnManager . DestroySceneObjects ( ) ;
756
779
int objectCount = messageReader . ReadInt32 ( ) ;
757
780
for ( int i = 0 ; i < objectCount ; i ++ )
758
781
{
0 commit comments