Some RPC methods are called, but others aren't
Options
I have two scripts I want to focus on: "GameMaster.cs" and "Player.cs". The test() method works (as "player" is able to update its own syncVar variable based on what the "gamemaster" sends), but the method syncID() doesn't work.
GameMaster.cs:
Player.cs:
GameMaster.cs:
private int syncVariable = 0; private PhotonView PV; private void Start() { PV = GetComponent<PhotonView>(); //create inital PhotonView object to reference later } void Update() { this.photonView.RPC("syncID", RpcTarget.All, this.gameObject.GetComponent<PhotonView>().ViewID); PV.RPC("RPCFunction", RpcTarget.AllBuffered, syncVariable) syncVariable += 1; } [PunRPC] void test(float syncVar) { Debug.LogError("SyncVar changed! " + syncVariable); } [PunRPC] void syncID(int ID) { print("Changed colours"); }
Player.cs:
[PunRPC] void test(float syncVar) { SyncVariable = syncVar; Debug.LogError("SyncVar changed! " + SyncVariable); } [PunRPC] public void syncID(int ID) { print("added colour " + ID); //do other stuff like setting a child, etc. }
0
Comments
-
EDIT: I put the wrong RPC method call. It is intended to be
PV.RPC("test", RpcTarget.AllBuffered, syncVariable)
0