RPC NullReferenceException: Object reference not set to an instance of an object

Hi everyone, there was a tread about this problem but the thread did not help me. Here is a link to it. The ultimate solution was that the RPC was called by a child of the object that has the photon view compoment but in my case that is not the problem. I am trying to Instantiate a bomb that the player throws. The bomb variable is a prefab.
Here is my code:
private void FixedUpdate()
        {
            if (!photonView.IsMine && PhotonNetwork.IsConnected == true)
                return;
            if (shouldThrow)
            {
                shouldThrow = false;
                gameObject.GetComponent<PhotonView>().RPC("createBomb", RpcTarget.AllViaServer);

            }
        }
        [PunRPC]
        public void createBomb()
        {
            GameObject c4 = Instantiate(
                    bomb,
                    new Vector3(camera.transform.position.x, camera.transform.position.y, camera.transform.position.z),
                    Quaternion.Euler(camera.transform.rotation.eulerAngles.x, camera.transform.rotation.eulerAngles.y + 90, camera.transform.rotation.eulerAngles.z)
                    );
            c4.transform.position += camera.transform.forward;
            c4.GetComponent<Rigidbody>().AddForce(camera.transform.forward * speed);
            c4.GetComponent<Rigidbody>().AddForce(new Vector3(0, up, 0));
        }
The error is in line 508 in the script PhotonNetworkPart:
for (int index = 0; index < argumentsTypes.Length; index++)
I debugged the code and turns out that the argumentsTypes array is null. Can anybody help me?

Best Answer

Answers

  • Hey @JohnTube mod,
    I am using 2.15. Mabye I didn't update it correctly? can you tell me how to update it correctly?
    Thank you, Itai