NetworkIdentity.OnDeserializeSafely: use NetworkReader.Remaining

This commit is contained in:
vis2k 2021-06-14 17:48:23 +08:00
parent ccbd6185b4
commit aa71d2a848

View File

@ -997,7 +997,7 @@ internal void OnDeserializeAllSafely(NetworkReader reader, bool initialState)
{
// deserialize all components that were received
NetworkBehaviour[] components = NetworkBehaviours;
while (reader.Position < reader.Length)
while (reader.Remaining > 0)
{
// read & check index [0..255]
byte index = reader.ReadByte();