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()
206
206
internal List < FieldType > syncedFieldTypes = new List < FieldType > ( ) ;
207
207
private List < object > syncedFieldValues = new List < object > ( ) ;
208
208
private List < MethodInfo > syncedVarHooks = new List < MethodInfo > ( ) ;
209
+ private bool syncVarInit = false ;
209
210
//A dirty field is a field that's not synced.
210
211
private bool [ ] dirtyFields ;
211
212
internal void SyncVarInit ( )
212
213
{
214
+ syncVarInit = true ;
213
215
FieldInfo [ ] sortedFields = GetType ( ) . GetFields ( BindingFlags . Public | BindingFlags . NonPublic | BindingFlags . FlattenHierarchy | BindingFlags . Instance ) . OrderBy ( x => x . Name ) . ToArray ( ) ;
214
216
for ( byte i = 0 ; i < sortedFields . Length ; i ++ )
215
217
{
@@ -453,6 +455,8 @@ internal void FlushToClient(int clientId)
453
455
private float lastSyncTime = 0f ;
454
456
internal void SyncVarUpdate ( )
455
457
{
458
+ if ( ! syncVarInit )
459
+ SyncVarInit ( ) ;
456
460
SetDirtyness ( ) ;
457
461
if ( Time . time - lastSyncTime >= SyncVarSyncDelay )
458
462
{
You can’t perform that action at this time.
0 commit comments