Unity Mirror how to wait for command to complete and only then proceed to the local function

Viewed 13

Good evening everyone!

I am currently developing a multiplayer inventory. It has a client AddItem method. When it checks inventory for open/close slots, in case of success it calls a CmdAddItemToDatabase (adding to synclist) or CmdChangeItemAmount (if item to add and item in a slot are the same type).

The problem is, if I am trying to add 2 items in inventory, 1st item creates succesfully. But here is the problem: the local method goes further, while SyncList is not synced yet, and I have a critical error.

The question is: how can i know that the CmdMethod is finally executed, and only after it proceed the local method further?

0 Answers
Related