docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class NetworkTimeSystem

    NetworkTimeSystem is a standalone system which can be used to run a network time simulation. The network time system maintains both a local and a server time. The local time is based on

    Inheritance
    object
    NetworkTimeSystem
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Unity.Netcode
    Assembly: solution.dll
    Syntax
    public class NetworkTimeSystem

    Constructors

    Name Description
    NetworkTimeSystem(double, double, double, double)

    The constructor class for NetworkTickSystem

    Properties

    Name Description
    AdjustmentRatio

    Gets or sets the ratio at which the NetworkTimeSystem speeds up or slows down time.

    HardResetThresholdSec

    Gets or sets a threshold in seconds used to force a hard catchup of network time.

    LocalBufferSec

    Gets or sets the amount of time in seconds the server should buffer incoming client messages. This increases the difference between local and server time so that messages arrive earlier on the server.

    LocalTime

    The current local time with the local time offset applied

    ServerBufferSec

    Gets or sets the amount of the time in seconds the client should buffer incoming messages from the server. This increases server time. A higher value increases latency but makes the game look more smooth in bad networking conditions. This value must be higher than the tick length client side.

    ServerTime

    The current server time with the server time offset applied

    Methods

    Name Description
    Advance(double)

    Advances the time system by a certain amount of time. Should be called once per frame with Time.unscaledDeltaTime or similar.

    Reset(double, double)

    Resets the time system to a time based on the given network parameters.

    ServerTimeSystem()

    Creates a new instance of the NetworkTimeSystem class for a server instance. The server will not apply any buffer values which ensures that local time equals server time.

    Sync(double, double)

    Synchronizes the time system with up-to-date network statistics but does not change any time values or advance the time.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)