Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug If NetworkList is updated immediately after Spawn, NetworkList is not synchronized with the client.

Discussion in 'Netcode for GameObjects' started by modaka-cov, Jul 13, 2022.

  1. modaka-cov

    modaka-cov

    Joined:
    Jul 5, 2021
    Posts:
    3
    Hi.
    If I spawn a NetworkBehaviour with a NetworkList while the client is connected, the NetworkList does not seem to be synchronized with the client.

    this is reproduction project.
    https://github.com/chromee/netcode-networklist-test

    The following two scripts are important.
    https://github.com/chromee/netcode-.../Assets/Scripts/NetworkListHolderGenerator.cs
    https://github.com/chromee/netcode-networklist-test/blob/master/Assets/Scripts/NetworkListHolder.cs

    NetworkListHolder is a NetworkBehaviour with a NetworkList.

    The NetworkListHolderGenerator spawn a NetworkObject to which the NetworkListHolder is attached and then updates the NetworkList.
    I prepared three patterns for the timing of updating.

    1. before spawn
    2. after spawn
    3. 1 second after spawn

    In patterns 1 and 2, the NetworkList will not be synced to the client.
    Only in pattern 3 the NetworkList is synced to the client.

    If I replace NetworkList with NetworkVariable in this reproduction project, all patterns are synchronized to the client I would like NetworkList to have the same behavior.
     
  2. cerestorm

    cerestorm

    Joined:
    Apr 16, 2020
    Posts:
    653
    modaka-cov likes this.