File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
MLAPI/MonoBehaviours/Core Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -206,10 +206,12 @@ private void OnDestroy()
206206 internal List < FieldType > syncedFieldTypes = new List < FieldType > ( ) ;
207207 private List < object > syncedFieldValues = new List < object > ( ) ;
208208 private List < MethodInfo > syncedVarHooks = new List < MethodInfo > ( ) ;
209+ private bool syncVarInit = false ;
209210 //A dirty field is a field that's not synced.
210211 private bool [ ] dirtyFields ;
211212 internal void SyncVarInit ( )
212213 {
214+ syncVarInit = true ;
213215 FieldInfo [ ] sortedFields = GetType ( ) . GetFields ( BindingFlags . Public | BindingFlags . NonPublic | BindingFlags . FlattenHierarchy | BindingFlags . Instance ) . OrderBy ( x => x . Name ) . ToArray ( ) ;
214216 for ( byte i = 0 ; i < sortedFields . Length ; i ++ )
215217 {
@@ -453,6 +455,8 @@ internal void FlushToClient(int clientId)
453455 private float lastSyncTime = 0f ;
454456 internal void SyncVarUpdate ( )
455457 {
458+ if ( ! syncVarInit )
459+ SyncVarInit ( ) ;
456460 SetDirtyness ( ) ;
457461 if ( Time . time - lastSyncTime >= SyncVarSyncDelay )
458462 {
You can’t perform that action at this time.
0 commit comments