@@ -1258,48 +1258,20 @@ internal void SendClientRPCPerformance(ulong hash, List<ulong> clientIds, Strea
1258
1258
1259
1259
stream . CopyFrom ( messageStream ) ;
1260
1260
1261
- if ( clientIds == null )
1261
+ if ( IsHost )
1262
1262
{
1263
- for ( int i = 0 ; i < NetworkingManager . Singleton . ConnectedClientsList . Count ; i ++ )
1263
+ if ( this . NetworkedObject . observers . Contains ( NetworkingManager . Singleton . LocalClientId ) )
1264
1264
{
1265
- if ( ! this . NetworkedObject . observers . Contains ( NetworkingManager . Singleton . ConnectedClientsList [ i ] . ClientId ) )
1266
- {
1267
- if ( NetworkLog . CurrentLogLevel <= LogLevel . Developer ) NetworkLog . LogWarning ( "Silently suppressed ClientRPC because a target in the bulk list was not an observer" ) ;
1268
- continue ;
1269
- }
1270
-
1271
- if ( IsHost && NetworkingManager . Singleton . ConnectedClientsList [ i ] . ClientId == NetworkingManager . Singleton . LocalClientId )
1272
- {
1273
- messageStream . Position = 0 ;
1274
- InvokeClientRPCLocal ( hash , NetworkingManager . Singleton . LocalClientId , messageStream ) ;
1275
- }
1276
- else
1277
- {
1278
- InternalMessageSender . Send ( NetworkingManager . Singleton . ConnectedClientsList [ i ] . ClientId , MLAPIConstants . MLAPI_CLIENT_RPC , string . IsNullOrEmpty ( channel ) ? "MLAPI_DEFAULT_MESSAGE" : channel , stream , security , null ) ;
1279
- }
1265
+ messageStream . Position = 0 ;
1266
+ InvokeClientRPCLocal ( hash , NetworkingManager . Singleton . LocalClientId , messageStream ) ;
1280
1267
}
1281
- }
1282
- else
1283
- {
1284
- for ( int i = 0 ; i < clientIds . Count ; i ++ )
1268
+ else
1285
1269
{
1286
- if ( ! this . NetworkedObject . observers . Contains ( clientIds [ i ] ) )
1287
- {
1288
- if ( NetworkLog . CurrentLogLevel <= LogLevel . Normal ) NetworkLog . LogWarning ( "Cannot send ClientRPC to client without visibility to the object" ) ;
1289
- continue ;
1290
- }
1291
-
1292
- if ( IsHost && clientIds [ i ] == NetworkingManager . Singleton . LocalClientId )
1293
- {
1294
- messageStream . Position = 0 ;
1295
- InvokeClientRPCLocal ( hash , NetworkingManager . Singleton . LocalClientId , messageStream ) ;
1296
- }
1297
- else
1298
- {
1299
- InternalMessageSender . Send ( clientIds [ i ] , MLAPIConstants . MLAPI_CLIENT_RPC , string . IsNullOrEmpty ( channel ) ? "MLAPI_DEFAULT_MESSAGE" : channel , stream , security , null ) ;
1300
- }
1270
+ if ( NetworkLog . CurrentLogLevel <= LogLevel . Developer ) NetworkLog . LogWarning ( "Silently suppressed ClientRPC because a connected client was not an observer" ) ;
1301
1271
}
1302
1272
}
1273
+
1274
+ InternalMessageSender . Send ( MLAPIConstants . MLAPI_CLIENT_RPC , string . IsNullOrEmpty ( channel ) ? "MLAPI_DEFAULT_MESSAGE" : channel , clientIds , stream , security , this . NetworkedObject ) ;
1303
1275
}
1304
1276
}
1305
1277
}
@@ -1324,28 +1296,20 @@ internal void SendClientRPCPerformance(ulong hash, Stream messageStream, ulong c
1324
1296
stream . CopyFrom ( messageStream ) ;
1325
1297
1326
1298
1327
- for ( int i = 0 ; i < NetworkingManager . Singleton . ConnectedClientsList . Count ; i ++ )
1299
+ if ( IsHost && NetworkingManager . Singleton . LocalClientId != clientIdToIgnore )
1328
1300
{
1329
- if ( NetworkingManager . Singleton . ConnectedClientsList [ i ] . ClientId == clientIdToIgnore )
1330
- continue ;
1331
-
1332
- if ( ! this . NetworkedObject . observers . Contains ( NetworkingManager . Singleton . ConnectedClientsList [ i ] . ClientId ) )
1333
- {
1334
- if ( NetworkLog . CurrentLogLevel <= LogLevel . Developer ) NetworkLog . LogWarning ( "Silently suppressed ClientRPC because a connected client was not an observer" ) ;
1335
- continue ;
1336
- }
1337
-
1338
-
1339
- if ( IsHost && NetworkingManager . Singleton . ConnectedClientsList [ i ] . ClientId == NetworkingManager . Singleton . LocalClientId )
1301
+ if ( this . NetworkedObject . observers . Contains ( NetworkingManager . Singleton . LocalClientId ) )
1340
1302
{
1341
1303
messageStream . Position = 0 ;
1342
1304
InvokeClientRPCLocal ( hash , NetworkingManager . Singleton . LocalClientId , messageStream ) ;
1343
1305
}
1344
1306
else
1345
1307
{
1346
- InternalMessageSender . Send ( NetworkingManager . Singleton . ConnectedClientsList [ i ] . ClientId , MLAPIConstants . MLAPI_CLIENT_RPC , string . IsNullOrEmpty ( channel ) ? "MLAPI_DEFAULT_MESSAGE" : channel , stream , security , null ) ;
1308
+ if ( NetworkLog . CurrentLogLevel <= LogLevel . Developer ) NetworkLog . LogWarning ( "Silently suppressed ClientRPC because a connected client was not an observer" ) ;
1347
1309
}
1348
1310
}
1311
+
1312
+ InternalMessageSender . Send ( MLAPIConstants . MLAPI_CLIENT_RPC , string . IsNullOrEmpty ( channel ) ? "MLAPI_DEFAULT_MESSAGE" : channel , clientIdToIgnore , stream , security , this . NetworkedObject ) ;
1349
1313
}
1350
1314
}
1351
1315
}
0 commit comments