Skip to content

Commit 3c3b18a

Browse files
committed
Temp fix for issue where the server despawns an object while the client wants to write to it
1 parent db717b3 commit 3c3b18a

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

com.unity.netcode.gameobjects/Runtime/Core/NetworkBehaviourUpdater.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ internal void NetworkBehaviourUpdate(NetworkManager networkManager)
2323
{
2424
#if DEVELOPMENT_BUILD || UNITY_EDITOR
2525
m_NetworkBehaviourUpdate.Begin();
26-
#endif
27-
try
26+
#endif
27+
try
2828
{
2929
if (networkManager.IsServer)
3030
{
@@ -57,6 +57,8 @@ internal void NetworkBehaviourUpdate(NetworkManager networkManager)
5757
else
5858
{
5959
// when client updates the server, it tells it about all its objects
60+
m_DirtyNetworkObjects.RemoveWhere((sobj) => sobj == null);
61+
6062
foreach (var sobj in m_DirtyNetworkObjects)
6163
{
6264
if (sobj.IsOwner)

0 commit comments

Comments
 (0)