{!See https://docs.google.com/document/d/1takg_GmIBBKKTj-GHZCwzxohpQz7Bhekivkk72kYMtE/edit for reference implementation of OneTrust, dataLayer and GTM} {!OneTrust Cookies Consent} {!OneTrust Cookies Consent end} {!dataLayer initialization push} {!dataLayer initialization push end} {!Google Tag Manager} {!Google Tag Manager end} Struct NetworkTick | Netcode for Entities | 1.1.0-pre.3
docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct NetworkTick

    A simple struct used to represent a network tick. This is using a uint internally, but it has special logic to deal with invalid ticks, and it handles wrap around correctly.

    Implements
    IEquatable<NetworkTick>
    Inherited Members
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    Namespace: Unity.NetCode
    Assembly: solution.dll
    Syntax
    [Serializable]
    public struct NetworkTick : IEquatable<NetworkTick>

    Constructors

    Name Description
    NetworkTick(uint)

    Constructor, the start tick can be 0. Use this instead of the default constructor since that will generate an invalid tick.

    Properties

    Name Description
    Invalid

    A value representing an invalid tick, this is the same as 'default' but provide more context in the code.

    IsValid

    Check if the tick is valid. Not all operations will work on invalid ticks.

    SerializedData

    The serialized data for a tick. Includes both validity and tick index.

    TickIndexForValidTick

    Get the tick index assuming the tick is valid. Should be used with care since ticks will wrap around.

    TickValue

    Helper property to enable exception-free visibility in the Entity Inspector

    Methods

    Name Description
    Add(uint)

    Add a delta to the tick, assumes the tick is valid.

    Decrement()

    Decrement the tick, assumes the tick is valid.

    Equals(object)

    Compare two ticks, also works for invalid ticks.

    Equals(NetworkTick)

    Compare two ticks, also works for invalid ticks.

    GetHashCode()

    Get a hash for the tick.

    Increment()

    Increment the tick, assumes the tick is valid.

    IsNewerThan(NetworkTick)

    Check if this tick is newer than another tick. Assumes both ticks are valid.

    Subtract(uint)

    Subtract a delta from the tick, assumes the tick is valid.

    TicksSince(NetworkTick)

    Compute the number of ticks which passed since an older tick. Assumes both ticks are valid. If the passed in tick is newer this will return a negative value.

    ToFixedString()

    Convert the tick to a fixed string. Also handles invalid ticks.

    Operators

    Name Description
    operator ==(in NetworkTick, in NetworkTick)

    Compare two ticks, also works for invalid ticks.

    operator !=(in NetworkTick, in NetworkTick)

    Compare two ticks, also works for invalid ticks.

    In This Article
    Back to top
    Copyright © 2023 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)