Error " PhotonView with ID 1001 has no (non-static) method" when calling RPC
Options
I'm trying to call an RPC on a GameObject which has one script and a PhotonView
When I fire the RPC I get the following error:
However looks like everything is well defined in the inspector and my code
I have tried:
- with and without the transfer of ownership
- With "Fixed" or "Takeover" on the PhotonView component
but it doesn't work, same error. Not sure what I'm missing.
When I fire the RPC I get the following error:
PhotonView with ID 1001 has no (non-static) method "RotateJointHorizontally" that takes 5 argument(s): String, Single, Int32, Int32, Int32
UnityEngine.Debug:LogError(Object)
However looks like everything is well defined in the inspector and my code
.... private PhotonView _photonView; void Start () { _photonView = this.GetComponent<PhotonView>(); } [PunRPC] public void RotateJointHorizontally (string jointName, float angle, int direction, float minAngle, float maxAngle) { //.... Logic } private void DetectInput () { // _photonView.TransferOwnership (PhotonNetwork.LocalPlayer); _photonView.RPC ("RotateJointHorizontally", RpcTarget.All, baseHorizontalJoint.name, jointRotationSpeed * Time.deltaTime, 1, -180, 180); }
I have tried:
- with and without the transfer of ownership
- With "Fixed" or "Takeover" on the PhotonView component
but it doesn't work, same error. Not sure what I'm missing.
0
Comments
-
I found the error a few minutes after posting this question. A stupid one, but maybe the same could happen to somebody so I leave the answer.
The RPC was obtained from converting a local function that was working. I could pass the angles as integers although the parameters were float (there was an automatic conversion). When passing the same parameters to the RPC the types were mismatching.
This means I had to adapt the call:_photonView.RPC ("RotateJointHorizontally", RpcTarget.All, baseHorizontalJoint.name, (float) jointRotationSpeed * Time.deltaTime, 1, -180.0f, 180.0f);
0