How can I get the value variable from prefab(Client)

I try to check player status when player status this game is win. but sometimes it work, sometimes it's not. Please help...
IEnumerator StartGame()
{
do
{
var ChkPlayerStatus = FindObjectOfType<PlayerControl>();
bool xx = ChkPlayerStatus.PlayerStatus; //Get Player staus from Player Control
if (!xx)
{
if (PhotonNetwork.IsMasterClient)
{
strRandomNumber = BallNumber[Random.Range(0, BallNumber.Length)]; //Master Client Random Number
photonView.RPC("RandomNumber", RpcTarget.All, strRandomNumber); //Send Random Number to all player
}

}
else
{
Debug.Log("win = " + xx);
PlayerStatus = true;
photonView.RPC("Bingo", RpcTarget.AllViaServer, PlayerStatus);
break;
}
Debug.Log("now = " + xx);
yield return new WaitForSeconds(2);
} while (PlayerPrefs.GetString("HasPlayerWin") == "false"); //if player status not win(true)
txtWinner.text = "Has Player Win"; //For check that out of loop
Debug.Log("GameEnd");
}
Sign In or Register to comment.