Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Third Party [Photon] Handling uncaught RPC calls

Discussion in 'Multiplayer' started by guto-thomas, Jan 11, 2018.

  1. guto-thomas


    Mar 12, 2012
    Hello everyone,

    I'm currently making a Combat Arms sort of lobby system.

    Basically there's the lobby to view the available rooms.

    When you click on a room you go to the "room" scene, where there's a UI to view all the available players and theirs statuses, customize your characters and things you do before actually clicking 'Play'.

    There's also the actual "Game" scene, which you go to when you click 'Play'.

    The way I did this, was by making 2 scenes share the same photon room, but it came with a problem.

    When I fire an RPC in the "Game" scene, it's trying to be caught in the "Room" scene, because the Game scene has photon views to synchronize player spawning and such.

    My question is: How can I handle an RPC call that is not caught because there's no matching method? I want to get rid of the error it throws, without necessarily implementing the method.

    Another workaround for it, would be by specifying which photon player IDs receive the RPC (Is that a way to do that?). I have a custom property that tells when a player is in game. This way I would be able to correctly target the RPC.

    *I know I can achieve this with an event, but I'd rather do it with an RPC as it looks cleaner.

    Thanks in advance!
    Last edited: Jan 11, 2018
  2. Munchy2007


    Jun 16, 2013
    You could use the RPC overload which takes a PhotonPlayer as a target, and then iterate over all the players to send the RPC to; But personally I would most likely use RaiseEvent myself.