Sync inventory

Shadocks

New member
Hi, I bought a multiplayer pun pack, but I have a problem, one moment in my game, I need to give through the script a weapon to a specific player, so I tried "PlayerX.GetComponent<Inventory>().Pickup(gun,1,-1, true, true);". but the problem is that when I do that only the host sees the gun in the hands and not the other players. How can I solve this problem?

think it's an inventory synchronization problem but I don't know how to solve it.
 
Last edited:
Inventory.Pickup is not aware of the network. You will need to instead start the PickupItem ability which will be synced over the network. In the demo scene you can trace the logic by placing a breakpoint within ItemPickupBase.DoItemPickup.
 
Thank you for this advice, i have a last question , how I can deactivate the automatic change of the weapon which one pick up? (i would like to stay unequiped when i pickup)
 
Last edited:
Top