It’s my first time making an online game and I made an inventory but it doesn’t work when I try it, I’m using the steam online subsystem
Inventory systems for multiplayer are 100% managed by the server.
Adding, Removing, Using, Sorting etc.
The client inputs an action, locally validates it can do so, then RPC’s the server.
Server validates it can do so, then does it.
We have the client check first to reduce garbage RPC’s that will be denied from flooding the network. This should be done for everything multiplayer related.
Spawned Actors should happen on the server. They should also be set to replicate. This ensures the copy of your character on other clients gets the spawned item as well.
Inventory is best served if stored in the PlayerState class. One good reason why is you get disconnected your Pawn is destroyed. On reconnect there’s no record of the inventory if stored in pawn.
Player States persist for a reasonable amount of time after disconnects. This is why Health, Score etc are stored there as well.
You can still do a component, just have it reside in the PS.