JS RPCs not sending properly

Hello!

A project I'm working on was recently converted to PUN, using the wizard. Having spent a few days ironing out all the compile errors, I've discovered that RPCs aren't working correctly. I've only tested it on my own machine (never used it to connect multiple computers), but if it doesn't work on the one computer, I'm pretty sure it won't work over a network.

I am connecting to the PhotonNetwork using ConnectUsingSettings("1"); , the room is created using PhotonNetwork.CreateRoom(), etc etc.

I'm using JavaScript, and this is my first time out with Photon (it's the cloud version, if it helps) . Could someone please tell me what I'm doing wrong?

[code2=javascript]...
photonView.RPC("iV", PhotonTargets.All, PhotonNetwork.AllocateViewID(), GameVehicleID, temp, 0, (isHost ? 1 : 0), 0, 0);
...

@RPC
function iV(viewID : int, vehId : int, vehName : String, isBot : int, isIt : int, score : int, specialInput : int) {
print("running iV");
...
}
...[/code2]

I'm also getting the following error message:
Cannot send RPCs in Lobby! RPC dropped.
UnityEngine.Debug:LogWarning(Object)
PhotonNetwork:RPC(PhotonView, String, PhotonTargets, Object[]) (at Assets/Plugins/PhotonNetwork/PhotonNetwork.cs:1763)
PhotonView:RPC(String, PhotonTargets, Object[]) (at Assets/Plugins/PhotonNetwork/PhotonView.cs:205)
$:MoveNext() (at Assets/Martian Assets/Scripts/Game/Game.js:221)

Comments

  • You need to wait until you actually joined the game. It seems the client's state is "Lobby" still but you can't call RPCs in the lobby.
    See: "Cannot send RPCs in Lobby! RPC dropped."