Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug NetworkTickSystem processes disabled NetworkTransforms

Discussion in 'Netcode for GameObjects' started by Nyphur, Aug 7, 2023.

  1. Nyphur

    Nyphur

    Joined:
    Jan 29, 2016
    Posts:
    91
    If you disable a script that has registered to NetworkTickSystem.Tick, it stays registered and the tick system wastes a ton of performance on some kind of unspecified overheads for it even when no data is transmitted over the network. For example, NetworkTransform doesn't de-register itself from the tick when disabled even though the actual syncing stops happening.

    I'm making a game where the scene has a large number of objects that are only required to be synced in small numbers in specific circumstances, so I disable the networktransforms until sync is required. There is not currently another simple way to tell the object to stop syncing transform than to disable the script, and the overhead for processing the tick remains.

    I'm going to implement a custom solution instead for my purposes later, but the NetworkTransform script should correctly implement OnEnable and OnDisable.