Skip to content

SendTickRate (Single Sync Values) unhandled by NetworkVariable.cs #1185

@dylanwijnen1

Description

@dylanwijnen1

Describe the bug
SendTickRate below zero is not handled for NetworkVariable.

To Reproduce

  1. Create a script with NetworkVariable of any simple type such as a float, bool, double.
  2. Set the SendTickRate to below 0.
  3. Add a handler to OnValueChanged
  4. Update the NetworkVariable from the server

Actual outcome
Observe the handler being called as fast as it is written to on the connected clients.

Expected outcome
Expected behavior as defined per the documentation.

If you want values to be synced only once (at spawn), the built-in container's send rate can be set to a negative value.

Additional context
Just check the differences between NetworkList.IsDirty and NetworkVariable.IsDirty.

/// <summary>
/// Sets whether or not the variable needs to be delta synced
/// </summary>
public void SetDirty(bool isDirty)
{
m_IsDirty = isDirty;
}

public bool IsDirty()
{
if (m_DirtyEvents.Count == 0) return false;
if (Settings.SendTickrate == 0) return true;
if (Settings.SendTickrate < 0) return false;
if (NetworkManager.Singleton.NetworkTime - LastSyncedTime >= (1f / Settings.SendTickrate)) return true;
return false;
}

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions