- Home /
Question by
thetoby2004 · Dec 17, 2020 at 01:47 PM ·
networkinggamemirrorlobbyroom
Deactivate RoomPlayer when GamePlayer is spawed (Mirror Multiplayer)
Hey my problem:
I have a moving Lobby Player with UI. When the player hits "ready" the scene is changing and the GamePlayer spawns (different movement and scripts). So I have to disable the RoomPlayer´s model and UI.
public override GameObject OnRoomServerCreateGamePlayer(NetworkConnection conn, GameObject roomPlayer)
{
[code ...]
roomPlayer.GetComponent<NetworkPlayerManager>().CmdDeactivateAllRoomPlayers();
[code ...]
}
in the Network Manager I have this function to disable all Players in there own script:
[Command]
public void CmdDeactivateAllRoomPlayers()
{
RpcDeactivateAllRoomPlayers();
}
[ClientRpc]
void RpcDeactivateAllRoomPlayers()
{
if (!isLocalPlayer)
{
return;
}
this.gameObject.SetActive(false);
}
This is working for the client, which is also the server.. On all other Clients it doas not work. Pls help!
Thx Toby :)
Comment
Your answer
Follow this Question
Related Questions
How to get all created rooms and join any one of them in PHOTON 2 Answers
Mirror multiplayer authority issue 0 Answers
Android multiplayer using hostpot wifi 1 Answer
Animations playing only in the Host and not on the clients - Unity Mirror Networking. 1 Answer
Loading texures from client-owned PNG files in Mirror 0 Answers