Fixed critial SyncVar issue where array length would be checked before array was created

This commit is contained in:
Albin Corén 2018-03-31 02:02:51 +02:00
parent a793dc6fad
commit cf34bc3313

View File

@ -302,11 +302,11 @@ namespace MLAPI
} }
} }
} }
if(dirtyFields.Length > 255) dirtyFields = new bool[syncedFields.Count];
if (dirtyFields.Length > 255)
{ {
Debug.LogError("MLAPI: You can not have more than 255 SyncVar's per NetworkedBehaviour!"); Debug.LogError("MLAPI: You can not have more than 255 SyncVar's per NetworkedBehaviour!");
} }
dirtyFields = new bool[syncedFields.Count];
} }
internal void OnSyncVarUpdate(object value, byte fieldIndex) internal void OnSyncVarUpdate(object value, byte fieldIndex)