Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Assets/FishNet/Runtime/Serializing/Writer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,17 @@ public void WriteNetworkObject(NetworkObject nob)
return;
}

/* NetworkManager is assigned when a NetworkObject initializes
* and is never cleared by ResetState, so if it is set this object
* was previously spawned and is now despawning/despawned (or pooled).
* Send a null reference rather than falling back to PrefabId, which
* the reader would resolve to the prefab template instead of null. */
if (nob.NetworkManager != null)
{
WriteNullReferenceId();
return;
}

WriteNetworkObjectId(nob.PrefabId);
}
else
Expand Down