Button Clicks and Destroying with Photon

Options
So i'm making a game that uses xbox controllers, and I'm just learning photon.
I have all the input working for the controllers but i'm having problems with the button presses being read by the other client. So say I have it when the game starts for whoever wants to be player 1 to press start and then it will say player 2 press start.
If I press start on one screen it destroys the text on that screen but it doesn't destroy the text on the other screen and display player2 press start, but if I press start after that on the screen that still has player1 press start on screen the player2 on the other screen gets deleted and goes into the game while the screen i'm currently on goes to player2 press start now. Is there a way to send button clicks to other clients connected in your room?

Also, It seems to sometimes work and sometimes doesn't, If I test it in unity and the other is the exe it works, but if I test it with the two .exe it doesn't work.

Another question as well, I have the game already made pretty much for play on one computer you can play with two players but I want it to go over the network, I don't really know where t start,

Comments

  • Leepo
    Options
    Maybe you should think differently.

    Your game waits for a "game start" event, not a buttonpress.
    Hook up the buttonpress to a LocalPlayerStarted() method. This method then calls a RPC that is send to all players:

    if(buttonPress..){
    photonView.RPC("StartedGame", PhotonTargets.All);
    }

    Then in the "void StartedGame();" take care of switching the GUI to the started game etc. This method is then always executed on every player. (Unless some players join later...you could use AllBuffered for that, or manually send a message from the masterclient)