RPC only working in Editor

Options
Hello, I am trying to set up an RPC call in my game, I have other RPC's setup so I know how to use them correctly. Let me just give you an example of what is happening.

Example 1:
The master client is running in editor, whilst another client is running a build. If the RPC gets called from the master server in editor the RPC works locally but does not get sent to the build client.


Example 2:

The master client is running a build and another client is running the Editor version, the master client on the build calls the RPC and nothing happens on their end but the RPC works for the editor version.

Basically the RPC does not want to get called on a build no matter if it is the master client or not and I cannot figure out why. If the RPC can clearly send and receive then surely it is not my code that is the problem.

Here is the RPC function:

[PunRPC]
    public void LockDoors()
    {
        GameObject[] doors = GameObject.FindGameObjectsWithTag("door");

        for (int i = 0; i < doors.Length; i++)
        {
            Door doorscript = doors[i].GetComponent<Door>();

            doors[i].GetComponent<AudioSource>().Play();
            doorscript.Locked = true;
            doorscript.LockedTimer = 5f;
        }
    }

Which is being called by:

photonView.RPC("LockDoors", PhotonTargets.AllBuffered, null);

Answers

  • Tobias
    Options
    Any errors in the log of the build? Anything at all?
  • bdar
    Options
    I have the exact same problems, the error says Null reference exception. It seems like MonoBehaviourPunCallbacks' photonView inherited variable is not working for me. I just used PhotonView component instead of the inherited one and now it works.