I’m having a very strange issue with my multiplayer inventory system and I’d really appreciate some insight.
Previously, everything was working correctly. However, I’m now experiencing a replication/ownership issue that I can’t explain.
The main problem is this:
When I pick up an item as a client, the client behaves as if the item was never picked up. The item does not appear in the inventory widget, and for example if I pick up a weapon, I cannot equip it.
While debugging, I found something very odd:
In Character0’s Inventory Component, when I call Get Owner and print the result:
When it runs on Character0, it returns Character1 as the owner.
And in Character1’s Inventory Component:
When it runs there, it returns Character0 as the owner.
So it seems like the Inventory Components are somehow referencing the wrong character as their owner, almost as if they are swapped.
What makes this even more confusing is that when I test directly inside the old project of mine, Character0’s component correctly returns Character0 as its owner. So the plugin itself appears to behave correctly in isolation.
I genuinely don’t understand how the component ownership could be reversed like this in-game.
Has anyone experienced something similar with ActorComponent ownership in a multiplayer setup? Any idea what could cause components to report the wrong owner between clients?
in multiplayer its more likely that the function is running on the wrong netmode, ie is it running on client instead of server? inventory stuff must be done on server.
I also learned that what I was assuming is actually impossible.
What I experienced was simply because each instance is separate, so I shouldn’t rely too much on object names when debugging.
Let me explain why I thought this was the issue.
I already have a project that I’ve been running as multiplayer for a long time. However, for the past few months I’ve been working in singleplayer mode without testing multiplayer.
Now I see that almost everything that used to work with RunOnServer is broken.(When I say “nothing works in Run on Server,” I mean it executes on the server side, but I can’t see the result on the client side.)
For some of them, I managed to fix it by switching to Multicast, but some things don’t work at all, even with Multicast.
While trying to debug that bigger issue, I mistakenly thought it was related to the problem I described in this topic — but apparently it’s not.
In your opinion, what could cause this kind of situation?
Not only inventory, with everything i have this problem. for example can you check my latest question? that was working before, like inventory thing.
I made a replications thing before so i know the basics, i will call run on server first, multicast should be called from inside from it sdr. but deeply, i don’t know why these things stop working all of sudden