Modifying variables of teammates with RPC

Hi, I'm trying to send an RPC to my online teammate with an integer. Basically, I know the integer makes it to the right player because the "count value 2" Debug.Log prints the correct updated value(5) but in the Update() function the "count value" Debug.Log continues to print 0. Why isn't the count variable being modified outside of the receiver function? This has been killing me all day, thank you so much for any help you can offer. Im new to the whole networking thing so I'm sure I just dont understand the idea of syncing variables or something. Heres the basic code, thanks again
int count = 0;

    void Update(){
        Debug.Log("count value: " + count); 
    }

    void Sender(){
        int abc = 5;
        photonView.RPC("hitObject2", friendlyPlayer.GetComponent<PhotonView>().owner, abc);
    }

    [RPC]
    void Receiver(int number){
        count = number;
        Debug.Log("count value 2: " + count);               
    }

Comments

Sign In or Register to comment.