Skip to content

Commit 9145e51

Browse files
committed
fix: using the real NetworkTickSystem, instead of a placeholder one
1 parent 7a49af9 commit 9145e51

2 files changed

Lines changed: 4 additions & 19 deletions

File tree

com.unity.multiplayer.mlapi/Runtime/Core/NetworkedBehaviour.cs

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,6 @@
2222

2323
namespace MLAPI
2424
{
25-
// todo: This is temporary, to be replaced by the tick system
26-
static class TickSystem
27-
{
28-
// todo: this might belong in the tick system, in the end
29-
// special value to indicate "No tick information"
30-
public const ushort k_NoTick = ushort.MaxValue;
31-
// Number of ticks over which the tick number wraps back to 0
32-
public const ushort k_TickPeriod = k_NoTick - 1;
33-
34-
public static ushort GetTick()
35-
{
36-
return (ushort)(((long)(Time.time / 0.050)) % k_TickPeriod);
37-
}
38-
}
39-
4025
/// <summary>
4126
/// The base class to override to write networked code. Inherits MonoBehaviour
4227
/// </summary>
@@ -542,7 +527,7 @@ internal void InitializeVars()
542527
internal static void NetworkedBehaviourUpdate()
543528
{
544529
// Don't NetworkedBehaviourUpdate more than once per network tick
545-
ushort tick = TickSystem.GetTick();
530+
ushort tick = NetworkTickSystem.Instance.GetTick();
546531
if (tick == currentTick)
547532
{
548533
return;
@@ -873,7 +858,7 @@ internal static void HandleNetworkedVarUpdate(List<INetworkedVar> networkedVarLi
873858

874859
long readStartPos = stream.Position;
875860

876-
networkedVarList[i].ReadField(stream, TickSystem.k_NoTick, TickSystem.k_NoTick);
861+
networkedVarList[i].ReadField(stream, NetworkTickSystem.k_NoTick, NetworkTickSystem.k_NoTick);
877862
ProfilerStatManager.networkVarsRcvd.Record();
878863

879864
if (NetworkingManager.Singleton.NetworkConfig.EnsureNetworkedVarLengthSafety)
@@ -970,7 +955,7 @@ internal static void SetNetworkedVarData(List<INetworkedVar> networkedVarList, S
970955

971956
long readStartPos = stream.Position;
972957

973-
networkedVarList[j].ReadField(stream, TickSystem.k_NoTick, TickSystem.k_NoTick);
958+
networkedVarList[j].ReadField(stream, NetworkTickSystem.k_NoTick, NetworkTickSystem.k_NoTick);
974959

975960
if (NetworkingManager.Singleton.NetworkConfig.EnsureNetworkedVarLengthSafety)
976961
{

com.unity.multiplayer.mlapi/Runtime/NetworkedVar/NetworkedVar.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public T Value
9696
{
9797
// Setter is assumed to be called locally, by game code.
9898
// When used by the host, it is its responsibility to set the RemoteTick
99-
RemoteTick = TickSystem.k_NoTick;
99+
RemoteTick = NetworkTickSystem.k_NoTick;
100100

101101
isDirty = true;
102102
T previousValue = InternalValue;

0 commit comments

Comments
 (0)