File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
MLAPI/MonoBehaviours/Core Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -454,9 +454,8 @@ internal void SyncVarUpdate()
454
454
{
455
455
if ( ! syncVarInit )
456
456
SyncVarInit ( ) ;
457
- if ( SyncVarSyncDelay > 0 && NetworkingManager . singleton . NetworkTime - lastSyncTime >= SyncVarSyncDelay )
457
+ if ( SyncVarSyncDelay > 0 && NetworkingManager . singleton . NetworkTime - lastSyncTime >= SyncVarSyncDelay && SetDirtyness ( ) )
458
458
{
459
- SetDirtyness ( ) ;
460
459
byte nonTargetDirtyCount = 0 ;
461
460
byte totalDirtyCount = 0 ;
462
461
byte dirtyTargets = 0 ;
@@ -568,17 +567,23 @@ internal void SyncVarUpdate()
568
567
}
569
568
}
570
569
571
- private void SetDirtyness ( )
570
+ private bool SetDirtyness ( )
572
571
{
573
572
if ( ! isServer )
574
- return ;
573
+ return false ;
574
+
575
+ bool dirty = false ;
575
576
for ( int i = 0 ; i < syncedVarFields . Count ; i ++ )
576
577
{
577
578
if ( ! syncedVarFields [ i ] . FieldInfo . GetValue ( this ) . Equals ( syncedVarFields [ i ] . FieldValue ) )
579
+ {
578
580
syncedVarFields [ i ] . Dirty = true ; //This fields value is out of sync!
581
+ dirty = true ;
582
+ }
579
583
else
580
584
syncedVarFields [ i ] . Dirty = false ; //Up to date;
581
585
}
586
+ return dirty ;
582
587
}
583
588
#endregion
584
589
You can’t perform that action at this time.
0 commit comments