Hey guys! So I know this is probably a pretty basic question for the networking side of things. However, I have been doing more with multiplayer replication and I am still learning but I ran into an issue I can’t seem to figure out and I need to make sure, before I go any further, than I am doing things right in the first place. Logically, to my understanding, everything should work but no matter what I do, it doesn’t.
So, I have an Actor Component (Inventory) that I have a Variable Array type of my Inventory Slot (Structure) and I have that set to “Replicated”. In my inventory component is where I do everything except a few functions. In my player character Blueprint I have the basic function “Interact” setup to an Interface blueprint that tells my “Inventory Widget” to populate my Inventory Uniform Grid panel with empty slots. So my Inventory Widget opens with “x” amount of empty slots unless my Inventory Component - Inventory Array has items in it, then it fills those slots with the item structure from that variable. Everything works as expected, even multiplayer it all works properly. I can even pick items up with no issues. The issue I am having is I have a “Container” that has its own Inventory Component attached to it (its the same component as in my character BP) I have the container fill itself with random items from a data table I made and all of that works well even on multiplayer.
However, When I “transfer items” from the container to the character(well call player 1), the ‘other’ character(well call player 2) still displays the items in the container widget (assuming he was in the container the same time as player 1).
So in short: Player 1 Opens a container, while in the container, player 2 opens the same container, displaying the same items that player 1 sees as expected. Player 1 then removes the items from the container but player 2 still sees those items. If player 2 attempts to take those items after player 1, then the items remove from the inventory but the server doesn’t add them to the player because they dont actually exist. All is good so far, however when I tell my players to “refresh” the container inventory to clear any removed items, the only player that seems to work is player 1 and player 2 pitches an “Accessed none from the Container Widget”.
My Question is, how do I tell all players in the container to refresh the inventory any time the inventory changes.
I’ve tried using the RepNotify, but I don’t think I am using it properly.
Any help is much appreciated! Thanks in advance!