PhotonView with ID has no method marked with the [PunRPC](C#) property! BUT IT HAS ???
Options
In my game 2 players only join a room and i have to switch turns between them so i do something like that:
as you can see I'm not " using Photon; " if that have to do something...?
Please any clue would be great, Thank you!
using UnityEngine; // .. more code public PhotonView photonView; // i get it from editor bool myTurn = false; void Start() { // .. some other code if (PhotonNetwork.player.isMasterClient) { myTurn = true; } } void Update() { // ... LOTS OF CODE if(myTurn) { // Play till i finish } if(EndOfTurn) { // ... Do things myTurn = false; photonView.RPC("SwitchTurns()", PhotonTargets.Others); } } // ... Many lines of code [PunRPC] void SwitchTurns() { myTurn = true; }and my GameObject has the script and the PhotonView component (Owner is Fixed) with no Observed Components and I've tried observing the script same error too also tried making " SwitchTurns() " public and used " Photon.MonoBehaviour " instead nothing too
as you can see I'm not " using Photon; " if that have to do something...?
Please any clue would be great, Thank you!
0
Best Answers
-
Hi,
It should be " photonView.RPC("SwitchTurns", PhotonTargets.Others);"
without the () for the name of the method.
https://doc.photonengine.com/en/pun/current/tutorials/rpcsandraiseevent
Bye,
Jean
1 -
Yeah I just did that and was going to close the question any way thanks and sorry for the trouble.jeanfabre said:Hi,
It should be " photonView.RPC("SwitchTurns", PhotonTargets.Others);"
without the () for the name of the method.
https://doc.photonengine.com/en/pun/current/tutorials/rpcsandraiseevent
Bye,
Jean0
Answers
-
I've been using PUN version 1.6X and tried updating to the latest which is now 1.71 and still the same error...0
-
Hi,
It should be " photonView.RPC("SwitchTurns", PhotonTargets.Others);"
without the () for the name of the method.
https://doc.photonengine.com/en/pun/current/tutorials/rpcsandraiseevent
Bye,
Jean
1 -
Yeah I just did that and was going to close the question any way thanks and sorry for the trouble.jeanfabre said:Hi,
It should be " photonView.RPC("SwitchTurns", PhotonTargets.Others);"
without the () for the name of the method.
https://doc.photonengine.com/en/pun/current/tutorials/rpcsandraiseevent
Bye,
Jean0 -
No worries this king of mistakes happens always, to everyone...
0