Skip to content

Commit 65ad815

Browse files
committed
Fixed host observer callack invoke
1 parent a886226 commit 65ad815

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

MLAPI/MonoBehaviours/Core/NetworkingManager.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,11 @@ public void StartHost(Vector3? pos = null, Quaternion? rot = null, int prefabId
569569

570570
prefabId = prefabId == -1 ? SpawnManager.GetNetworkedPrefabIndexOfName(NetworkConfig.PlayerPrefabName) : prefabId;
571571
NetworkedObject netObject = SpawnManager.CreateSpawnedObject(prefabId, 0, hostClientId, true, NetworkSceneManager.CurrentActiveSceneIndex, false, false, pos.GetValueOrDefault(), rot.GetValueOrDefault(), true, null, false, 0, false);
572-
netObject.observers.Add(hostClientId);
572+
573+
if (netObject.CheckObjectVisibility == null || netObject.CheckObjectVisibility(hostClientId))
574+
{
575+
netObject.observers.Add(hostClientId);
576+
}
573577

574578
SpawnSceneObjects();
575579

0 commit comments

Comments
 (0)