Skip to content

Commit 9508233

Browse files
committed
Changed spawnedObjects counting code
1 parent 9b76a81 commit 9508233

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

MLAPI/MonoBehaviours/Core/NetworkingManager.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.IO;
77
using UnityEngine;
88
using UnityEngine.Networking;
9+
using System.Linq;
910

1011
namespace MLAPI
1112
{
@@ -1136,14 +1137,9 @@ private void HandleApproval(int clientId, bool approved)
11361137

11371138

11381139
int sizeOfStream = 16 + ((connectedClients.Count - 1) * 4);
1139-
int amountOfObjectsToSend = 0;
1140-
foreach (KeyValuePair<uint, NetworkedObject> pair in SpawnManager.spawnedObjects)
1141-
{
1142-
if (pair.Value.ServerOnly)
1143-
continue;
1144-
else
1145-
amountOfObjectsToSend++;
1146-
}
1140+
1141+
int amountOfObjectsToSend = SpawnManager.spawnedObjects.Values.Count(x => x.ServerOnly == false);
1142+
11471143
if(NetworkConfig.HandleObjectSpawning)
11481144
{
11491145
sizeOfStream += 4;

0 commit comments

Comments
 (0)