Skip to content

Commit b0a5208

Browse files
update
Updating CreateObjectMessage to use the new GhostSpawnManager. Removing unused local/cached NetworkSpawnManager var.
1 parent 65c25a1 commit b0a5208

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

com.unity.netcode.gameobjects/Runtime/Messaging/Messages/CreateObjectMessage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public bool Deserialize(FastBufferReader reader, ref NetworkContext context, int
128128
//}
129129

130130
// For now, we will defer the create object message until the associated Ghost is spawned
131-
if (ObjectInfo.HasGhost && !networkManager.SpawnManager.GhostsPendingSpawn.ContainsKey(ObjectInfo.NetworkObjectId))
131+
if (ObjectInfo.HasGhost && !networkManager.SpawnManager.GhostSpawnManager.IsGhostPendingSpawn(ObjectInfo.NetworkObjectId))
132132
{
133133
if (networkManager.LogLevel == LogLevel.Developer)
134134
{

com.unity.netcode.gameobjects/Runtime/SceneManagement/SceneEventData.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,9 +1107,6 @@ internal void SynchronizeSceneNetworkObjects(NetworkManager networkManager)
11071107
{
11081108
builder.AppendLine($"[Read][Synchronize Objects][WPos: {InternalBuffer.Position}][NO-Count: {newObjectsCount}] Begin:");
11091109
}
1110-
#if UNIFIED_NETCODE
1111-
var spawnManager = m_NetworkManager.SpawnManager;
1112-
#endif
11131110

11141111
for (int i = 0; i < newObjectsCount; i++)
11151112
{

com.unity.netcode.gameobjects/Runtime/Spawning/GhostSpawnManager.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,11 @@ internal void MarkNetworkObjectAsDestroying(ulong networkObjectId)
198198
m_GhostsPendingSynchronization.Remove(networkObjectId);
199199
}
200200

201+
internal bool IsGhostPendingSpawn(ulong networkObjectId)
202+
{
203+
return m_GhostsPendingSpawn.ContainsKey(networkObjectId);
204+
}
205+
201206
/// <summary>
202207
/// Used in scene managment synchronization.
203208
/// Verifies if this <see cref="NetworkObject.SerializedObject"/> should defer its spawn until the associated GhostObject is created.

0 commit comments

Comments
 (0)