Hello,
I’m creating a card game (1vs1) with a tile board.
I’m having an issue between Hoster and Client:
When I play a card, I call the server to ask if I can create the card, than the server does a ClientRpc
that create the card to every player.
And that works perfectly.
The issue is coming along if I start to work with gameobjects edited by Server in cascade:
In the image you can see method PushCardFromTable: inside has a ServerRpc (the method move the card from tile 1,1 to tile 1,2).
The below method, TriggerPushEnemyEffect, has the current issue:
if I call TriggerPushEnemyEffect from Host, the Hoster see the card in tile (1,2)
meanwhile if I call TriggerPushEnemyEffect from the Client, I see the card in tile (1,1) (until the whole funcion is done).
AS you can imagine, I want work with the correct tile but I can’t if they have different behavior. I’m using a check like:
if (!NetworkManager.Singleton.IsClient)
{
return;
}
To be sure that hoster is working as client but even that doesn’t change anything.
Maybe I should do something like: “until the PushCardFromTable method is not done, don’t run code below”