'Unity Mirror Multiplayer UI Issue/Best Practice

Relatively new to the Mirror packages and had a question on best practice. Have initially used patterns for developing a game in single player but adjusting to multiplayer so refactoring code. I'm using events to update the UI inventory, so when a player picks up an item, their inventory collection is updated, then the UI update event is called.

The issue here is, when an item is picked up by either player it changes the UI to display that users inventory for all players. I'm looking for some advice on best practice - I could add the UI to the spawnable player, and adjust the event so that it effects only the player objects instance of UI, but I'm not sure that's best practice.

I was also thinking about updating the UI inventory bar so it requires a net ID on update, then pulling the collection of items displayed for that particular player with that net ID and only displaying that filtered selection from all inventories.

Some advice on what best practice would be to manage the UI changes in multiplayer would be super helpful. :D

Thanks All!

Michael



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source