@@ -524,10 +524,10 @@ internal void FlushToClient(uint clientId)
524524 writer . WriteUShort ( networkedObject . GetOrderIndex ( this ) ) ; //Behaviour OrderIndex
525525
526526 bool [ ] mask = GetDirtyMask ( false , clientId ) ;
527- for ( int i = 0 ; i < mask . Length ; i ++ ) writer . WriteBool ( mask [ i ] ) ;
528527
529528 for ( int i = 0 ; i < syncedVarFields . Count ; i ++ )
530529 {
530+ writer . WriteBool ( mask [ i ] ) ;
531531 if ( syncedVarFields [ i ] . Target && clientId != ownerClientId )
532532 continue ;
533533 FieldTypeHelper . WriteFieldType ( writer , syncedVarFields [ i ] . FieldInfo . GetValue ( this ) ) ;
@@ -584,10 +584,10 @@ internal void SyncVarUpdate()
584584 writer . WriteUShort ( networkedObject . GetOrderIndex ( this ) ) ; //Behaviour OrderIndex
585585
586586 bool [ ] mask = GetDirtyMask ( false ) ;
587- for ( int i = 0 ; i < mask . Length ; i ++ ) writer . WriteBool ( mask [ i ] ) ;
588587
589588 for ( int i = 0 ; i < syncedVarFields . Count ; i ++ )
590589 {
590+ writer . WriteBool ( mask [ i ] ) ;
591591 //Writes all the indexes of the dirty syncvars.
592592 if ( syncedVarFields [ i ] . Dirty == true )
593593 {
@@ -616,10 +616,10 @@ internal void SyncVarUpdate()
616616 writer . WriteUShort ( networkedObject . GetOrderIndex ( this ) ) ; //Behaviour OrderIndex
617617
618618 bool [ ] mask = GetDirtyMask ( false ) ;
619- for ( int i = 0 ; i < mask . Length ; i ++ ) writer . WriteBool ( mask [ i ] ) ;
620619
621620 for ( int i = 0 ; i < syncedVarFields . Count ; i ++ )
622621 {
622+ writer . WriteBool ( mask [ i ] ) ;
623623 //Writes all the indexes of the dirty syncvars.
624624 if ( syncedVarFields [ i ] . Dirty == true )
625625 {
@@ -649,10 +649,10 @@ internal void SyncVarUpdate()
649649 writer . WriteUShort ( networkedObject . GetOrderIndex ( this ) ) ; //Behaviour OrderIndex
650650
651651 bool [ ] mask = GetDirtyMask ( true ) ;
652- for ( int i = 0 ; i < mask . Length ; i ++ ) writer . WriteBool ( mask [ i ] ) ;
653652
654653 for ( int i = 0 ; i < syncedVarFields . Count ; i ++ )
655654 {
655+ writer . WriteBool ( mask [ i ] ) ;
656656 //Writes all the indexes of the dirty syncvars.
657657 if ( syncedVarFields [ i ] . Dirty == true && ! syncedVarFields [ i ] . Target )
658658 {
@@ -682,7 +682,7 @@ private bool SetDirtyness()
682682 if ( NetworkingManager . singleton . NetworkTime - syncedVarFields [ i ] . Attribute . lastSyncTime < syncedVarFields [ i ] . Attribute . syncDelay )
683683 continue ;
684684 //Big TODO. This will return true for reference objects. This NEEDS to be fixed. a better compare
685- if ( ! syncedVarFields [ i ] . FieldInfo . GetValue ( this ) . Equals ( syncedVarFields [ i ] . FieldValue ) )
685+ if ( ! FieldTypeHelper . ObjectEqual ( syncedVarFields [ i ] . FieldInfo . GetValue ( this ) . GetHashCode ( ) , syncedVarFields [ i ] . FieldValue ) )
686686 {
687687 syncedVarFields [ i ] . Dirty = true ; //This fields value is out of sync!
688688 syncedVarFields [ i ] . Attribute . lastSyncTime = NetworkingManager . singleton . NetworkTime ;
0 commit comments