Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

MLAPI NetworkList<> Not Syncing To Client

Discussion in 'Netcode for GameObjects' started by RobertGrospitch, Jun 4, 2021.

  1. RobertGrospitch

    RobertGrospitch

    Joined:
    Sep 8, 2020
    Posts:
    7
    Hello All,

    I have been working with MLAPI for the past month and am really loving everything it has to offer so far. Yesterday I ran into a situation where I needed to use a NetworkList of type int to hold a list of userdata that were connecting, however, it seems as though it is not working like any other network variable in MLAPI.

    I begin by adding
    Code (CSharp):
    1. using MLAPI.NetworkVariable.Collections;
    And then by declaring a new NetworkList of type int. For the purpose of testing I changed the read and write settings to the everyone value.

    Code (CSharp):
    1. NetworkList<int> testList = new NetworkList<int>(new NetworkVariableSettings { WritePermission = NetworkVariablePermission.Everyone, ReadPermission = NetworkVariablePermission.Everyone });
    I've placed this script on the player and called the isLocalPlayer to then give an input and testList.Add(1) to the list from both the client and the server. It seems as though the server can update the List however, it is not syncing over to the client and in some cases the client is giving an error that it is outofbounds even if I am just trying to call testList.Count on client side...

    The other strange thing is it’s not showing in the inspector when I make it public or serialize it. Which makes me think I’m initializing it wrong?

    I tried reading through the documentation for the past several hours and am making no progress. MLAPI support discord does not seem to be of any help either ATM. Am I not aware of some special permissions it needs? I saw a post saying something about a bug with NetworkLists<> and a known issue was the following

    KNOWN ISSUE:
    • For NetworkVariable, the NetworkDictionary List and Set must use the reliableSequenced channel.
    Reference: https://github.com/Unity-Technologies/com.unity.multiplayer.mlapi/releases/

    However, I could not really find anything on reliableSequenced channels.

    Hopefully I can get to the bottom of this one soon!

    Thank you,
     
    Last edited: Jun 4, 2021
  2. Altalus06

    Altalus06

    Joined:
    Sep 3, 2017
    Posts:
    10
    RobertGrospitch likes this.
unityunity