- Home /
How do you use a mirror network to enable player a to set up the canvas of player b?,mirror network a -> b player canvas open how??? please
Papago It may look strange using a translator.
I want to deliver the ball value from client a to client b. The only knowledge I know is synchronization using syncvar, command, and clientrpc, but I'm not sure if I should use msg send. Here's the problem.
When I say player A in the game, I want to get close to player B and press the interaction key to see the message "Do you want to request a team member?" on player A's screen when I press OK, and on player B's screen, "Do you want to accept player A's request?" The problem is that you can see the message on Player A's screen, but the message appears on Player B's screen. So far, when player A pressed the interaction key to player B with ray.hit, player A's script set the hit.collider.getcomponent<>().bool variable to true and used syncvarhook, command, and clientrpc to pass the changed value to the client. By the way, no. What method should I use to change the variable of the hit client and represent the canvas panel?
foreach (RaycastHit2D x in hitMan)
{
if (x.collider.CompareTag("OtherPlayer") && temp == 0)
{
Debug.Log("team request accept : " + x.collider.gameObject.name);
x.collider.GetComponent<Attack>().TestA(true);
temp++;
}
else
{
}
}
public void TestA(bool t)
{
if (t)
{
CmdTestA(t);
// Debug.Log(gameObject.name + "teamRequestAccept : " + t + "hasau" + hasAuthority);
GameObject.Find("Canvas").transform.GetChild(5).gameObject.SetActive(true);
}
else if (t == false)
{
// Debug.Log(gameObject.name + "teamRequestAccept : " + t + "hasau" + hasAuthority);
GameObject.Find("Canvas").transform.GetChild(5).gameObject.SetActive(false);
}
}
[SyncVar(hook = nameof(SetTeamRequestAccept_Hook))]
public bool teamRequestAccept;
public void SetTeamRequestAccept_Hook(bool old, bool n)
{
teamRequestAccept = n;
}
[Command (requiresAuthority = false)]
public void CmdTestA(bool t)
{
RpcTestA(t);
Debug.Log(gameObject.name + " command");
this.teamRequestAccept = t;
}
[ClientRpc]
public void RpcTestA(bool t)
{
Debug.Log(gameObject.name + " clientrpc");
this.teamRequestAccept = t;
}
Your answer

Follow this Question
Related Questions
Using networking solutions with AWS or Playfab servers with databases 1 Answer
Mirror - simple error message window 0 Answers
How to setup a instantiated gameobject with mirror networking correctly? 2 Answers
Unity/Mirror Network Delay After Transferring Client Authority 1 Answer
Unity networking tutorial? 6 Answers