Skip to content

Commit 1838808

Browse files
committed
Added Targeted SyncedVars that only sync to the owner of a object
1 parent c96634f commit 1838808

File tree

5 files changed

+539
-242
lines changed

5 files changed

+539
-242
lines changed

MLAPI/Attributes/SyncedVar.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,9 @@ public class SyncedVar : Attribute
1212
/// The method name to invoke when the SyncVar get's updated.
1313
/// </summary>
1414
public string hook;
15+
/// <summary>
16+
/// If true, the syncedVar will only be synced to the owner.
17+
/// </summary>
18+
public bool target;
1519
}
1620
}

MLAPI/Data/SyncedVarField.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Reflection;
5+
using System.Text;
6+
7+
namespace MLAPI.Data
8+
{
9+
internal class SyncedVarField
10+
{
11+
internal FieldInfo FieldInfo;
12+
internal FieldType FieldType;
13+
internal object FieldValue;
14+
internal MethodInfo HookMethod;
15+
internal bool Dirty;
16+
internal bool Target;
17+
}
18+
}

MLAPI/MLAPI.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
<Compile Include="Data\NetworkConfig.cs" />
7474
<Compile Include="Data\NetworkedPrefab.cs" />
7575
<Compile Include="Data\NetworkPool.cs" />
76+
<Compile Include="Data\SyncedVarField.cs" />
7677
<Compile Include="Data\TrackedPointData.cs" />
7778
<Compile Include="Data\TransportHost.cs" />
7879
<Compile Include="GlobalSuppressions.cs" />

0 commit comments

Comments
 (0)