PhotonView with ID has no method marked with the [PunRPC](C#) property! BUT IT HAS ???

In my game 2 players only join a room and i have to switch turns between them so i do something like that:

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!

Delete the brackets in the RPC function name string

photonView.RPC("SwitchTurns",PhotonTargets.Others);
1 Like

Yeah i just solved this and was going through all the posts I wrote to add that, thanks anyway :slight_smile:

1 Like