Invalid View ID of 0, but showing up as 4 in Hierarchy

Options
Hi,
I've been googling and troubleshooting for a while now and can't get a fix, a particular RPC keeps returning this error. This takes place in a lobby scene where the player initially connects to the network. I am running a few scripts that are attached to a gameobject already in scene with a photon view attached. What's more frustrating is another script on the exact same gameObject is able to successfully send RPC's belonging to the same photonView.

When I try to call an RPC from this script (which is attached to the "_MP_Lobby_stuff" game object, I get and invalid view ID error and this warning:
"Received RPC "SetPlayerReadyState" for viewID 0 but this PhotonView does not exist! Was remote PV. Remote called. By: 1 Maybe GO was destroyed but RPC not cleaned up."

The issue is in this part of my code for my 'Lobby_Controller' script.

//If is not the master, then called RPC which toggles state between ready and not ready. public void PlayerReadyButton() { int playerNumIndex = myLobbyData.myPlayerListIndex; if(!PhotonNetwork.isMasterClient) { if (!playersReady[playerNumIndex]) { myLobbyData.isReady = true; NetworkConnectionStarter.networkConnecterAccess.photonView.RPC("SetPlayerReadyState", PhotonTargets.AllBuffered, playerNumIndex, true); } else if (playersReady[playerNumIndex]) { myLobbyData.isReady = false; NetworkConnectionStarter.networkConnecterAccess.photonView.RPC("SetPlayerReadyState", PhotonTargets.AllBuffered, playerNumIndex, false); } } }

Anyone have any thoughts?
Thanks in advance.

Answers

  • Hi,

    So is it the case that indeed the gameobject was destroyed? it could be that the other script has time to process the rpc but not the other scripts. It looks like a race condition.

    What are you trying to achieve here? I am confused, because you can't sent RPC in the lobby, you must be inside a room to be able to send RPC. Can you confirm when you are trying to send this rpc?

    Bye,

    Jean
  • jeanfabre said:

    Hi,

    So is it the case that indeed the gameobject was destroyed? it could be that the other script has time to process the rpc but not the other scripts. It looks like a race condition.

    What are you trying to achieve here? I am confused, because you can't sent RPC in the lobby, you must be inside a room to be able to send RPC. Can you confirm when you are trying to send this rpc?

    Bye,

    Jean

    So I checked, the gameObject is not destroyed, I'm using this exact same game object to send other RPC's.
    Also, I apologize for using the wrong terminology, by 'lobby' i meant a room with a limit of 5 players that would allow them to chat and wait for other players to join before starting the actual game. PUN wise, it's a room that I'm attempting to call RPC's from.

    Hopefully this clears a few things.
  • Hi,

    ok, what's the setup for the gameObject you are sending rpc from? is it a scene object or an instance for a given player?

    what are the photonView setting for that GameObject?

    Bye,

    Jean