How should I handle events which comes form photon server?

I am making a ludo game where I am raising a reliable event for one dice number and selected token id from client A for client B. then In client B side I have two booleans two make sure that I received the dice number and token id in NetworkLogic::customEventAction function and extracting the data from both of them like this..

if(eventCode == 0)
void NetworkLogic::customEventAction(int playerNr, nByte eventCode, const ExitGames::Common::Object& eventContent)

//for reciever( Client B )
if (0 == eventCode)
int data = ExitGames::Common::ValueObject(eventContent).getDataCopy();
Globals::mIsDiceNumberRecieved = true;
Globals::mDiceNumber = data;


if(1 == eventCode)
int data = ExitGames::Common::ValueObject(eventContent).getDataCopy();
Globals::mIsTokenIDReceived = true;
Globals::mTokenID = data;

Now I am using those Globals like this in update() function :

//calling run to update

if( (Globals::mIsDiceNumberRecieved == true) )
//Using Globals::mDiceNumber here

and just after that...

if( (Globals::mIsTokeIDRecieved == true) )
//Using Globals::mTokenID here


I am not getting data consistently. The game is breaking in the middle when I get throw Six on dice multiple times and send it to photon.

Any clue what can cause this and how I can get data consistently so that player can play the complete game? Please help.


  • Hi @AnkitKushwah.

    Sorry, but I don't understand the question.

    What do you mean with not getting data consistently? What are you expecting to happen and what is actually happening?

    Also your code before "Now I am using those Globals like this in update() function" looks strange.
    The counts of '{' and of '}' do not match. There are 4 '{', but only 3 '}'. There is an opening function definition inside an if() clause, then the same if again inside that function.

    Also it would certainly improve the readability if you would put the code inside code tags to preserve whites pace formatting and special characters.

    On another note I don't know anything about the game "ludo" (aside from it being a board game that is quite popular in some parts of the world).

    Please keep that in mind when you explain your problem.
Sign In or Register to comment.