Search Unity

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

Resolved Cannot find NetworkDictionary in latest.

Discussion in 'Netcode for GameObjects' started by hoesterey, Jan 16, 2022.

  1. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    659
    Hi,
    I've been unable to find NetworkDictionary in the library though it is in the documentation, nore can I find a working example. I've read a ton of issues on the forums as well. Do Networked Dictionaries and Lists work? I'd love to use them and have been completely unsuccesful writing my own Network variable types as I can't find a good example anywhere.

    Thanks for any help!
     
  2. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    659
    Apparently they were removed but not from the documentation.
     
  3. MiTschMR

    MiTschMR

    Joined:
    Aug 28, 2018
    Posts:
    455
    The documentation is unfortunately not up to date and lots of information is missing.
     
  4. luke-unity

    luke-unity

    Joined:
    Sep 30, 2020
    Posts:
    306
    NetworkDictionary has been removed. NetworkLists still exist. You can write your own NetworkVariables by inheriting from the NetworkVariableBase class but I agree the process is not well documented (well not at all) and a bit complicated. I'm happy to help out with any specific issues.
     
    gamedevjake and Oyoshi like this.
  5. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    659
    Thanks for responding Luke.

    I'm holding off modifying network variable until its a bit more solidified but did create a dictionary that is a wrapper around the classes (essentially two lists) and ill share with the community once its tested.

    Id love to see unity make dictionaries and custom serialization less of a pain point in future releases. A lot of code needs to be written to send simple structures and you cannot currently serialize arrays into network variables.
     
  6. Takii

    Takii

    Joined:
    Sep 5, 2017
    Posts:
    7
    First thing i wanna use a networkvariable for is a dictionary with clientId and SteamId, just to find out they removed Network Dictionaries...
     
  7. gamedevjake

    gamedevjake

    Joined:
    Aug 16, 2022
    Posts:
    25
    Also curious if there are examples of NetworkDictionary out there now! Is it just too hard to make a well-working one?