Problem with PhotonView.RPC
Options
hi, i am new to unity and photon networking and i am converting my Maltiplayer game made using ultimate unity networking into Photon networking. with the tutorial(came with sdk) i have converted my all unity networking code to photon networking using photon converter. i have fixed all the bugs but at runtime i have having problem with PhotonView.RPC method. it is giving me this error.
"PhotonView with ID 1000 has no method "SetCurrentCharacter" that takes 0 argument(s):" and my code is as follows.
any help will be greatly appreciative. thanks.
"PhotonView with ID 1000 has no method "SetCurrentCharacter" that takes 0 argument(s):" and my code is as follows.
void SetupAvatar(int characterId) { if (character != null) PhotonNetwork.Destroy(character); character = (GameObject)PhotonNetwork.Instantiate(characterPrefabs[characterId], Vector3.zero, Quaternion.identity, 0); // Sync Avatar configuration if (PhotonNetwork.isNonMasterClientInGame || PhotonNetwork.isMasterClient) { Debug.Log("Before Set Current character!!!"); photonView.RPC("SetCurrentCharacter", PhotonTargets.AllBuffered); } } [RPC] void SetCurrentCharacter(PhotonViewID characterViewId) { Debug.Log("Set Current Character Method!!!"); PhotonView view = PhotonView.Find(characterViewId.ID); if (view == null) { PhotonNetwork.Destroy(gameObject); return; } character = view.gameObject; character.transform.parent = transform; character.transform.localPosition = Vector3.zero; character.transform.localRotation = Quaternion.identity; _animation = character.animation; if (_animation != null) enabled = true; }i do not know how to get the photon View id so i can pass it as a parameter in this method.
any help will be greatly appreciative. thanks.
0