Skip to content

Commit cf34bc3

Browse files
committed
Fixed critial SyncVar issue where array length would be checked before array was created
1 parent a793dc6 commit cf34bc3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

MLAPI/MonoBehaviours/Core/NetworkedBehaviour.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,11 @@ internal void SyncVarInit()
302302
}
303303
}
304304
}
305-
if(dirtyFields.Length > 255)
305+
dirtyFields = new bool[syncedFields.Count];
306+
if (dirtyFields.Length > 255)
306307
{
307308
Debug.LogError("MLAPI: You can not have more than 255 SyncVar's per NetworkedBehaviour!");
308309
}
309-
dirtyFields = new bool[syncedFields.Count];
310310
}
311311

312312
internal void OnSyncVarUpdate(object value, byte fieldIndex)

0 commit comments

Comments
 (0)