How to show a gameObject to another client?
What is the best practice to show a gameobject on the other client?
when User 1 press draw button. User 2 shows a panel with a Yes/No button. Same with user 2 press draw button. User 1 receives Yes /No button.
What I have is below. Any tips? Thank you
public void sendDraw() { photonView.RPC("draw_Rpc", RpcTarget.All); //if draw button is pressed } [PunRPC] public IEnumerator draw_Rpc() { if (photonView.IsMine) //PhotonNetwork.LocalPlayer { Debug.Log("Draw request sent"); drawButton.SetActive(false); //hide the draw button to avoid spam settingsPnl.SetActive(false); //hide the panel where the draw button is located } else { //i want these panel to show if draw request sent on the other player drawYes.SetActive(true); //draw panel containing yes and no button drawButton.SetActive(false); //hide the draw button } } public void yesToDraw() { int drawMatch = 0; GameModel.GetInstance().matchEnd(drawMatch); // match end } public void noToDraw() { drawButton.SetActive(true); //show draw button again because declined draw drawYes.SetActive(false); //hide panel containing yes and no button }
0
Answers
-
Maybe this helps: Doc about Synchronization and State.
0