Inventory synchronization

Hi @Justin
I am currently creating a Mirror integration based on the pun add-on.
I have everything synchronized except the inventory.

When a new client joins the inventory of the remoteplayers stays empty "(Nothing in inventory)". The weapon is visually there (equipped) and abilities are working (for example reloading), the weapon just doesn`t show up in the inventory.

Here an example:
Host
Localplayer Host: inventory is correct
Remoteplayer Client1: inventory is correct
Remoteplayer Client2: inventory is correct

Client1
Localplayer Client1: inventory is correct
Remoteplayer Host: inventory is empty
Remoteplayer Client2: inventory is empty

Client2
Localplayer Client2: inventory is correct
Remoteplayer Host: inventory is empty
Remoteplayer Client1: inventory is empty

What is weird is that the remoteplayers on the host have there inventory synchronized but it stays empty for the remoteplayers on the clients.

I assume this is the line where the inventory synchronization happens?
C#:
photonView.RPC("PickupItemIdentifierRPC", player, item.ItemIdentifier.ID, m_Inventory.GetItemIdentifierAmount(item.ItemIdentifier));
But I have converted that just like the other RPC´s. Do I have to look somewhere else?

Maybe there is more to it to synchronize the inventory? I just don´t know where to look at.
 
PickupItemIdentifierRPC is the correct RPC for spawning the items. There is also the PickupUsableItemActionRPC which is responsible for ensuring the consumable item identifiers are picked up - maybe that is missing? All of this is done within OnPlayerEnteredRoom within the PunCharacter component.
 
There is also the PickupUsableItemActionRPC which is responsible for ensuring the consumable item identifiers are picked up - maybe that is missing?
No, I have also convert that just like the other ones.
For example the converted method of StartAbilityRPC works as expected, active abilities are also active on the remote player.

I have also looked at PickupItemIdentifierRPC and changed the code (trial and error).
What seems to work is changing the following line from this:
C#:
   m_Inventory.Pickup(itemIdentifier, amount, -1, false, false, false);
to this:
C#:
   m_Inventory.Pickup(itemIdentifier, amount, -1, false, false);

So why doesn´t it work if notifyOnPickup is false?


As a side note:
I have not converted PunObjectPool because i don´t have droppable Items or projectiles in my game.
Could that be the problem?
 
Glad you're making progress.

So why doesn´t it work if notifyOnPickup is false?
I'm not sure - I would start by setting a breakpoint and taking a look inside the inventory to see why the item isn't correctly being added if notifyOnPickup is false. The PUN add-on has it has false.

I have not converted PunObjectPool because i don´t have droppable Items or projectiles in my game.
Could that be the problem?
No, I don't think so.
 
Top