@@ -593,7 +593,7 @@ internal void SyncVarUpdate()
593593 FieldTypeHelper . WriteFieldType ( writer , syncedVarFields [ i ] . FieldInfo . GetValue ( this ) , syncedVarFields [ i ] . FieldValue ) ;
594594 syncedVarFields [ i ] . FieldValue = FieldTypeHelper . GetReferenceArrayValue ( syncedVarFields [ i ] . FieldInfo . GetValue ( this ) , syncedVarFields [ i ] . FieldValue ) ;
595595 syncedVarFields [ i ] . Dirty = false ;
596- invokeSyncvarMethodOnHost ( syncedVarFields [ i ] . HookMethod ) ;
596+ InvokeSyncvarMethodOnServer ( syncedVarFields [ i ] . HookMethod ) ;
597597 }
598598 }
599599 List < uint > stillDirtyIds = InternalMessageHandler . Send ( "MLAPI_SYNC_VAR_UPDATE" , "MLAPI_INTERNAL" , writer , networkId ) ;
@@ -629,7 +629,7 @@ internal void SyncVarUpdate()
629629 //Only targeted SyncedVars were changed. Thus we need to set them as non dirty here since it wont be done by the next loop.
630630 syncedVarFields [ i ] . FieldValue = FieldTypeHelper . GetReferenceArrayValue ( syncedVarFields [ i ] . FieldInfo . GetValue ( this ) , syncedVarFields [ i ] . FieldValue ) ;
631631 syncedVarFields [ i ] . Dirty = false ;
632- invokeSyncvarMethodOnHost ( syncedVarFields [ i ] . HookMethod ) ;
632+ InvokeSyncvarMethodOnServer ( syncedVarFields [ i ] . HookMethod ) ;
633633 }
634634 }
635635 }
@@ -660,7 +660,7 @@ internal void SyncVarUpdate()
660660 FieldTypeHelper . WriteFieldType ( writer , syncedVarFields [ i ] . FieldInfo . GetValue ( this ) , syncedVarFields [ i ] . FieldValue ) ;
661661 syncedVarFields [ i ] . FieldValue = FieldTypeHelper . GetReferenceArrayValue ( syncedVarFields [ i ] . FieldInfo . GetValue ( this ) , syncedVarFields [ i ] . FieldValue ) ;
662662 syncedVarFields [ i ] . Dirty = false ;
663- invokeSyncvarMethodOnHost ( syncedVarFields [ i ] . HookMethod ) ;
663+ InvokeSyncvarMethodOnServer ( syncedVarFields [ i ] . HookMethod ) ;
664664 }
665665 }
666666 List < uint > stillDirtyIds = InternalMessageHandler . Send ( "MLAPI_SYNC_VAR_UPDATE" , "MLAPI_INTERNAL" , writer , ownerClientId , networkId , null , null ) ; // Send to everyone except target.
@@ -673,9 +673,9 @@ internal void SyncVarUpdate()
673673 }
674674 }
675675
676- void invokeSyncvarMethodOnHost ( MethodInfo hookMethod )
676+ private void InvokeSyncvarMethodOnServer ( MethodInfo hookMethod )
677677 {
678- if ( hookMethod != null && isHost )
678+ if ( isServer && hookMethod != null )
679679 hookMethod . Invoke ( this , null ) ;
680680 }
681681
0 commit comments