Photon masterClient only send data and won't receive?

Options
Hi,
I'm trying to sync a vector between players by sending from each player his unique index and unique vector[index] value


public int[] Bets;
public Text RoomBet;
public int BetIndex;
public int RecivedBetIndex;

public BingoPlayerScript BingoPlayer;


void Start()
{
BingoPlayer = GameObject.Find ("BingoPlayer").GetComponent();
PhotonNetwork.automaticallySyncScene = true;
BetIndex = Random.Range(0,20);
Bets = new int[20];
Bets[BetIndex] = BingoPlayer.BET;


}

void Update()
{
Bets[BetIndex] = BingoPlayer.BET;
Sum();
}


void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{

if (stream.isWriting)
{
Debug.Log("Sent");
stream.SendNext(BetIndex);
stream.SendNext(Bets[BetIndex]);
}
else
{
Debug.Log("Received");
RecivedBetIndex = (int)stream.ReceiveNext();
Bets[RecivedBetIndex] = (int)stream.ReceiveNext();
}
}

void Sum()
{
int tmpB = 0;
for (int i = 0; i < 20; i++)
{
tmpB += Bets[i];
}
RoomBet.text = tmpB.ToString();
}




In Unity console only prints "Sent" if masterClient and "Received" if it's not the masterClient
I need each player to send and receive data in real-time
The main idea is:
1) there are 20 players in one room
2) they can modify in real-time their "Bet" value
3) I need to collect from each player which is in the room, the "Bet" value, then sum it, then return it(the sum) to each player in the room (kind of total value that they can win)


If I can do it in any other way I'm pleased to hear it


Thanks
Have a good one

Comments