Skip to content

Commit df109de

Browse files
committed
Fixed potential issue when syncing only targeted messages
1 parent 1838808 commit df109de

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

MLAPI/MLAPI.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
</PropertyGroup>
3737
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Development|AnyCPU'">
3838
<DebugSymbols>true</DebugSymbols>
39-
<OutputPath>..\..\MLAPI-Examples\Assets\MLAPI\</OutputPath>
39+
<OutputPath>..\..\MLAPI-Examples\Assets\MLAPI\Lib\</OutputPath>
4040
<DefineConstants>DEBUG;TRACE</DefineConstants>
4141
<DebugType>full</DebugType>
4242
<PlatformTarget>AnyCPU</PlatformTarget>

MLAPI/MonoBehaviours/Core/NetworkedBehaviour.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,17 @@ internal void SyncVarUpdate()
744744
InternalMessageHandler.Send(ownerClientId, "MLAPI_SYNC_VAR_UPDATE", "MLAPI_INTERNAL", stream.ToArray()); //Send only to target
745745
}
746746

747+
if (nonTargetDirtyCount == 0)
748+
{
749+
//Seems like ONLY targeted syncedVars was changed. Thus we need to remove the dirty tags and return;
750+
for (int i = 0; i < syncedVarFields.Count; i++)
751+
{
752+
syncedVarFields[i].FieldValue = syncedVarFields[i].FieldInfo.GetValue(this);
753+
syncedVarFields[i].Dirty = false;
754+
}
755+
return;
756+
}
757+
747758
//It's sync time. This is the NON target receivers packet.
748759
using (MemoryStream stream = new MemoryStream())
749760
{

0 commit comments

Comments
 (0)