Skip to content

Commit

Permalink
fix: fixing syncvar hook not being called in host mode (#918)
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Frowen committed Sep 6, 2021
1 parent c37c88f commit 7accba7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Assets/Mirage/Weaver/Processors/SyncVarProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,15 @@ bool IsValidSyncVar(FieldDefinition field)

void ProcessSyncVar(FoundSyncVar syncVar)
{
// process attributes first before creating setting, otherwise it wont know about hook
syncVar.SetWrapType(module);
syncVar.ProcessAttributes();

FieldDefinition fd = syncVar.FieldDefinition;

string originalName = fd.Name;
Weaver.DebugLog(fd.DeclaringType, $"Sync Var {fd.Name} {fd.FieldType}");

syncVar.SetWrapType(module);

MethodDefinition get = GenerateSyncVarGetter(syncVar);
MethodDefinition set = GenerateSyncVarSetter(syncVar);
Expand All @@ -126,7 +129,6 @@ void ProcessSyncVar(FoundSyncVar syncVar)
propertySiteProcessor.Getters[fd] = get;
}

syncVar.ProcessAttributes();
syncVar.FindSerializeFunctions(writers, readers);

if (syncVar.FloatPackSettings.HasValue)
Expand Down

0 comments on commit 7accba7

Please sign in to comment.