Refreshing the UMG for a container when inventory changes - not functioning

I’ve been battling with this for a few weeks, and it’s driving me to frustration.
I have two separate systems that use the same basic code to refresh the UI when the inventory changes. One works, the other throws the following error:
683e37d0ba2f8ca5bfcf4582a153436a6de77ff7.jpeg

This is the code calling the refresh when the inventory changes:

This is what it calls:


(I removed the links from container during the process of trying to debug this, I just haven’t removed the pin)
ContainerUIEventGraph.jpg

The ContainerUI variable is set when the UI is opened, at the same time that PlayersViewing is set. The initial opening of the UI works, but the error comes when the refresh is called, and it doesn’t run the refresh.

Any help at all would be appreciated!

Is Container UI a Widget?

If yes, they don’t replicate. You can’t call the Client RPC on them.

There is no other object on the Client Side linked to them. Every client has their own and no one else knows about them.
If you want to access the Clients UI, you need to call the Client RPC on an Actor that the Client owns, for example the PlayerController
or PlayerCharacter and then access the variable. It also makes no sense to make the Variable of the UI replicated.

Check my compendium to learn what Actors exist on what Players etc:

http://cedric.bnslv.de/unreal-engine-4-network-compendium-released/

Hi Exi,

As in the pictures above, that’s exactly what I’m doing. The issue is that it isn’t working.

The inventory for the container, which is an actor, is replicated with onrep. When the inventory changes, it tells the viewing players (set when the UI is opened by clicking on the container actor) to refresh the UI stored at ContainerUI (ALSO set by the container actor when the UI is opened). The exact same code works for vendors, but gives the displayed error for containers.

Well it tells you that the Objects aren’t matching. As I said, replication on a Widget is not a thing.
Change the Event from ClientRPC to a normal Custom Event and also remove the replication of that Variable.

UI is not replicated. :stuck_out_tongue:

I see that you use the OnRep function, so that is fine. Is the OnRep called? If not, what exactly is it bound to? An Array?
If it’s not called, try to set the Array with itself.

But the main reason for that error should be that you try to call an Owning Client event that is not working on UI cause UI doesn’t replicate.

Ahhhh, I understand. I guess I misunderstood how the Owning Client worked. I’d changed them all to that originally because I thought maybe they were getting called on the server, and I was trying to force them to only run on client :slight_smile: I will give that a try, thank you!

edit
So, update to this. Making the recommended changes did get rid of the error on the server, and removed the delay, but still didn’t fix the other issue, the UI not refreshing. I re-wrote it to check every instance of that UI, make sure the container variable matched the container in which the inventory had changed, and that worked fine.

I’m still puzzled as to why the code that refreshes the vendor inventory works perfectly, but the code that deals with container inventory in the exact same way doesn’t, but I’ll chalk it up to weirdness and move on :slight_smile: