@@ -593,6 +593,7 @@ internal void SyncVarUpdate()
593
593
FieldTypeHelper . WriteFieldType ( writer , syncedVarFields [ i ] . FieldInfo . GetValue ( this ) , syncedVarFields [ i ] . FieldValue ) ;
594
594
syncedVarFields [ i ] . FieldValue = FieldTypeHelper . GetReferenceArrayValue ( syncedVarFields [ i ] . FieldInfo . GetValue ( this ) , syncedVarFields [ i ] . FieldValue ) ;
595
595
syncedVarFields [ i ] . Dirty = false ;
596
+ invokeSyncvarMethodOnHost ( syncedVarFields [ i ] . HookMethod ) ;
596
597
}
597
598
}
598
599
List < uint > stillDirtyIds = InternalMessageHandler . Send ( "MLAPI_SYNC_VAR_UPDATE" , "MLAPI_INTERNAL" , writer , networkId ) ;
@@ -628,6 +629,7 @@ internal void SyncVarUpdate()
628
629
//Only targeted SyncedVars were changed. Thus we need to set them as non dirty here since it wont be done by the next loop.
629
630
syncedVarFields [ i ] . FieldValue = FieldTypeHelper . GetReferenceArrayValue ( syncedVarFields [ i ] . FieldInfo . GetValue ( this ) , syncedVarFields [ i ] . FieldValue ) ;
630
631
syncedVarFields [ i ] . Dirty = false ;
632
+ invokeSyncvarMethodOnHost ( syncedVarFields [ i ] . HookMethod ) ;
631
633
}
632
634
}
633
635
}
@@ -658,6 +660,7 @@ internal void SyncVarUpdate()
658
660
FieldTypeHelper . WriteFieldType ( writer , syncedVarFields [ i ] . FieldInfo . GetValue ( this ) , syncedVarFields [ i ] . FieldValue ) ;
659
661
syncedVarFields [ i ] . FieldValue = FieldTypeHelper . GetReferenceArrayValue ( syncedVarFields [ i ] . FieldInfo . GetValue ( this ) , syncedVarFields [ i ] . FieldValue ) ;
660
662
syncedVarFields [ i ] . Dirty = false ;
663
+ invokeSyncvarMethodOnHost ( syncedVarFields [ i ] . HookMethod ) ;
661
664
}
662
665
}
663
666
List < uint > stillDirtyIds = InternalMessageHandler . Send ( "MLAPI_SYNC_VAR_UPDATE" , "MLAPI_INTERNAL" , writer , ownerClientId , networkId , null , null ) ; // Send to everyone except target.
@@ -670,6 +673,12 @@ internal void SyncVarUpdate()
670
673
}
671
674
}
672
675
676
+ void invokeSyncvarMethodOnHost ( MethodInfo hookMethod )
677
+ {
678
+ if ( hookMethod != null && isHost )
679
+ hookMethod . Invoke ( this , null ) ;
680
+ }
681
+
673
682
private bool SetDirtyness ( )
674
683
{
675
684
if ( ! isServer )
0 commit comments