Identify Master player in Room
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on PUN.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
Identify Master player in Room
JANESTHEKING
2016-01-29 11:50:15
hello,
if i assign some tag to Master of room. than In another instance of Game can find the tag with Master object or Not??
currently if i use simple method to assign master tag to player who connects first. but in another instance i cant find the player with master tag in remotely Gameplay. and if i use RPC to assign tag than the newly generated player got also execute this code and get the master Tag in Both game play.
Please help me ..
if any other idea to identify player from which is master or i want to find out view id of master player.
Suggest me please....
Comments
crodriguez08
2016-01-29 22:43:23
You could use the RPC to assign then when you're going to execute the code, do a check to see if photonView.isMine (or isn't, depends on who is supposed to run the code).
JANESTHEKING
2016-01-30 07:21:53
@crodriguez08
Hello thanks for reply.
i have also try with RPC method. but in another gameplay their local player will get master than there are two master tag object in game.
Simply i want the master player photon view id from any instance. if it is local in room or remotely generated player at another instance.
Hi,
PhotonNetwork.isMasterClient returns true if client is master of currently joined room (in PUN terms).
If you need 'tag' other clients, use custom player properties.
JANESTHEKING
2016-02-02 10:10:04
@vadim
Thanks for reply.
If i join anyones created room than how can i will be master????. But same issue happen with me.
in My code lets see just check my code what i have done.
foreach(PhotonPlayer player1 in PhotonNetwork.playerList)
{
if(player1.isMasterClient)
{
player.transform.tag = "master";
}
}
In this code player is instantiated gameobject . here in this code i use foreach for all player of room and i check which player satisfied ismaterclient condition this player got master tag.so only one player from room should satisfied this condition.
But this script in all instance than all generated local player get this master tag. i don't know why this happen.
As i know there will be only one master player in room. so why such problem arise.
please help me....