Unity-Technologies / com.unity.netcode.gameobjects

Netcode for GameObjects is a high-level netcode SDK that provides networking capabilities to GameObject/MonoBehaviour workflows within Unity and sits on top of underlying transport layer.
MIT License
2.13k stars 430 forks source link

Network dictionary, or a better integration between netcode and lobby #2611

Open nadavMihov opened 1 year ago

nadavMihov commented 1 year ago

Is your feature request related to a problem? Please describe. I want to be able to map each network manager id with a lobby player, so I can get each player's name. Currently, it's hard to do it because I don't have something like a netwrok dictionary to map an id to an index in the lobby players list.

Describe the solution you'd like I would like a network dictionary or a way to bind player's netcode id with the lobby service player object of them Describe alternatives you've considered creating a network list where the index represents the netcode id and the value in that index is the index of the player in the lobby player list. This solution is hard to maintain and creates a lot of variables. Also, if I want to store some information about the player inside the list I have to create multiple lists for different information (player name, etc.)

Putting the netcode id of a player in the lobby player data is also possible but syncing the lobby takes time so this information in hard to get on all clients.

Additional context

TheCaveOfWonders commented 1 year ago

there is a Network Dictionary from the community contributions.

https://github.com/Unity-Technologies/multiplayer-community-contributions/tree/main/com.community.netcode.extensions/Runtime/NetworkDictionary

if you are on v1.5.1 you would also need the changes in this PR as they have not been merged in yet. https://github.com/Unity-Technologies/multiplayer-community-contributions/pull/231

nadavMihov commented 1 year ago

Hello, Thank you for the reply. How do I download the dictionary to use it?