@@ -524,10 +524,10 @@ internal void FlushToClient(uint clientId)
524
524
writer . WriteUShort ( networkedObject . GetOrderIndex ( this ) ) ; //Behaviour OrderIndex
525
525
526
526
bool [ ] mask = GetDirtyMask ( false , clientId ) ;
527
- for ( int i = 0 ; i < mask . Length ; i ++ ) writer . WriteBool ( mask [ i ] ) ;
528
527
529
528
for ( int i = 0 ; i < syncedVarFields . Count ; i ++ )
530
529
{
530
+ writer . WriteBool ( mask [ i ] ) ;
531
531
if ( syncedVarFields [ i ] . Target && clientId != ownerClientId )
532
532
continue ;
533
533
FieldTypeHelper . WriteFieldType ( writer , syncedVarFields [ i ] . FieldInfo . GetValue ( this ) ) ;
@@ -584,10 +584,10 @@ internal void SyncVarUpdate()
584
584
writer . WriteUShort ( networkedObject . GetOrderIndex ( this ) ) ; //Behaviour OrderIndex
585
585
586
586
bool [ ] mask = GetDirtyMask ( false ) ;
587
- for ( int i = 0 ; i < mask . Length ; i ++ ) writer . WriteBool ( mask [ i ] ) ;
588
587
589
588
for ( int i = 0 ; i < syncedVarFields . Count ; i ++ )
590
589
{
590
+ writer . WriteBool ( mask [ i ] ) ;
591
591
//Writes all the indexes of the dirty syncvars.
592
592
if ( syncedVarFields [ i ] . Dirty == true )
593
593
{
@@ -616,10 +616,10 @@ internal void SyncVarUpdate()
616
616
writer . WriteUShort ( networkedObject . GetOrderIndex ( this ) ) ; //Behaviour OrderIndex
617
617
618
618
bool [ ] mask = GetDirtyMask ( false ) ;
619
- for ( int i = 0 ; i < mask . Length ; i ++ ) writer . WriteBool ( mask [ i ] ) ;
620
619
621
620
for ( int i = 0 ; i < syncedVarFields . Count ; i ++ )
622
621
{
622
+ writer . WriteBool ( mask [ i ] ) ;
623
623
//Writes all the indexes of the dirty syncvars.
624
624
if ( syncedVarFields [ i ] . Dirty == true )
625
625
{
@@ -649,10 +649,10 @@ internal void SyncVarUpdate()
649
649
writer . WriteUShort ( networkedObject . GetOrderIndex ( this ) ) ; //Behaviour OrderIndex
650
650
651
651
bool [ ] mask = GetDirtyMask ( true ) ;
652
- for ( int i = 0 ; i < mask . Length ; i ++ ) writer . WriteBool ( mask [ i ] ) ;
653
652
654
653
for ( int i = 0 ; i < syncedVarFields . Count ; i ++ )
655
654
{
655
+ writer . WriteBool ( mask [ i ] ) ;
656
656
//Writes all the indexes of the dirty syncvars.
657
657
if ( syncedVarFields [ i ] . Dirty == true && ! syncedVarFields [ i ] . Target )
658
658
{
@@ -682,7 +682,7 @@ private bool SetDirtyness()
682
682
if ( NetworkingManager . singleton . NetworkTime - syncedVarFields [ i ] . Attribute . lastSyncTime < syncedVarFields [ i ] . Attribute . syncDelay )
683
683
continue ;
684
684
//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 ) )
686
686
{
687
687
syncedVarFields [ i ] . Dirty = true ; //This fields value is out of sync!
688
688
syncedVarFields [ i ] . Attribute . lastSyncTime = NetworkingManager . singleton . NetworkTime ;
0 commit comments