diff --git a/MLAPI/MonoBehaviours/Core/NetworkedObject.cs b/MLAPI/MonoBehaviours/Core/NetworkedObject.cs index ce4c7064c..323c0b948 100644 --- a/MLAPI/MonoBehaviours/Core/NetworkedObject.cs +++ b/MLAPI/MonoBehaviours/Core/NetworkedObject.cs @@ -6,10 +6,15 @@ namespace MLAPI //Will be used for objects which will be spawned automatically across clients public class NetworkedObject : MonoBehaviour { + [HideInInspector] public uint NetworkId; + [HideInInspector] public int OwnerClientId = -1; + [HideInInspector] public int SpawnablePrefabId; - internal bool IsPlayerObject = false; + [HideInInspector] + public bool IsPlayerObject = false; + public bool ServerOnly = false; public bool isLocalPlayer { get diff --git a/MLAPI/MonoBehaviours/Core/NetworkingManager.cs b/MLAPI/MonoBehaviours/Core/NetworkingManager.cs index a20fb2add..c8c4fd542 100644 --- a/MLAPI/MonoBehaviours/Core/NetworkingManager.cs +++ b/MLAPI/MonoBehaviours/Core/NetworkingManager.cs @@ -744,9 +744,19 @@ namespace MLAPI } if (NetworkConfig.HandleObjectSpawning) { - writer.Write(spawnedObjectIds.Count); + int amountOfObjectsToSend = 0; for (int i = 0; i < spawnedObjectIds.Count; i++) { + if (spawnedObjects[spawnedObjectIds[i]].ServerOnly) + continue; + else + amountOfObjectsToSend++; + } + writer.Write(amountOfObjectsToSend); + for (int i = 0; i < spawnedObjectIds.Count; i++) + { + if (spawnedObjects[spawnedObjectIds[i]].ServerOnly) + continue; writer.Write(spawnedObjects[spawnedObjectIds[i]].IsPlayerObject); writer.Write(spawnedObjects[spawnedObjectIds[i]].NetworkId); writer.Write(spawnedObjects[spawnedObjectIds[i]].OwnerClientId);