Hi!
I have list with several items
var list = new List<int>();
list.Add(1);
list.Add(2);
list.Add(3);
list.Add(4);
Each player can take item from it, this done locally, not via rpc.
When player take item, rpc sended to other players to remove item from list.
RemoveItemFromList(itemId);
_photonView.RPC("RemoveItem", PhotonTargets.Others, item.Id);
[RPC]
private void RemoveItem(int itemId)
{
RemoveItemFromList(itemId);
}
private void RemoveItemFromList(int itemId)
{
var item = list.First(x=>x == itemId);
list.Remove(item);
}
It’s working normal, but when several players get items simultaneously i have an error. Because two players can hit the same item. How can i sync them?
I am using Photon Cloud.