Player.getIsMasterClient() giving wrong result?

Hey, I have this function from LoadBalancingListener override
void PhotonLoadBalancingListener::joinRoomEventAction(int playerNr, 
	const ExitGames::Common::JVector<int>& playernrs, const ExitGames::LoadBalancing::Player& player)
and everytime I do

if (PhotonLBClient->getLocalPlayer().getIsMasterClient()),
it is always returning true for every player, even for new player joins.

I also tried taking player from the function parameter and calling
player.getIsMasterClient(), it's also returning true all the time.

Am i doing the wrong things? do I need to loop manually through all integer JVector and get the lowest one to check if it is master client?


  • Hi, I think problem in somewhere else. I`ve just checked it on my application and getIsMasterClient() works as expected
  • Kaiserludi
    Kaiserludi admin
    edited August 2016
    Hi @kingathur61.

    Client::getLocalPlayer().getIsMasterClient() works just fine for me.

    I have added the following two lines at the end of void NetworkLogic::joinRoomEventAction(int playerNr, const ExitGames::Common::JVector<int>& /*playernrs*/, const ExitGames::LoadBalancing::Player& player) in demo_loadBalancing from the Client SDK:
    	bool isMaster = mLoadBalancingClient.getLocalPlayer().getIsMasterClient();
    	EGLOG(ExitGames::Common::DebugLevel::INFO, L"local Client isMaster: %ls", isMaster?L"true":L"false");
    No further code modifications have been done (except for adding a valid appID, of course).

    Then I have started three instances of the demo and let the first one create a room and the second and third one join that room.
    As expected and intended the first one logs "true", while the second and third one both log "false".

    Thank you @Neposeda for confirming this.
  • juaxix
    juaxix ✭✭
    edited February 2022

    Please check that method, in the latest SDK ( it is returning an incorrect value after some frames, having just one player in the room, while joined a room

    ExitGames::LoadBalancing::MutablePlayer& Player = m_photonCloudClient->getLocalPlayer();
    return Player .getIsMasterClient();

    will return false. but it is true (it's the only player in there, and the master client id is the local player one). While using

    m_photonCloudClient->getLocalPlayer().getNumber() == m_photonCloudClient->getCurrentlyJoinedRoom().getMasterClientID()

    will return true (getIsInGameRoom also returns true of course)