Hello. I use PUN in my unity project. So please, help me with this task:
I want to say some specific target to do something. Namelly OnSomethingHappened() I want to call function of some object (for example by viewID). I don't want to say everybody "Use that function", I want to say message only to one specific target. For example "Hey, target. Please change your rb.velocity and color. Thx." As I have got it, I have to use RPC. So I want to do something like:
photonView.RPC("FuncName", PhotonTargets.SpecificTarget, ...);
Photon can't do this, so I try to call RPC for all PhotonTargets (PhotonTargets.All) and write inside the function some checking:
if (photonView.viewID == SendedViewID) do smth //before I send to function parameter int SendedViewID = SomeObject.GetComponent().viewID;
But it doesn't work, because photonView.viewID never equals SendedViewID and I don't know why. I've read a lot of RPC documentation on different sources, but can't understand why photonView.viewID (whis is calling inside RPC function) always equals viewID of sender (not recipient).
Thank you.
I want to say some specific target to do something. Namelly OnSomethingHappened() I want to call function of some object (for example by viewID). I don't want to say everybody "Use that function", I want to say message only to one specific target. For example "Hey, target. Please change your rb.velocity and color. Thx." As I have got it, I have to use RPC. So I want to do something like:
photonView.RPC("FuncName", PhotonTargets.SpecificTarget, ...);
Photon can't do this, so I try to call RPC for all PhotonTargets (PhotonTargets.All) and write inside the function some checking:
if (photonView.viewID == SendedViewID) do smth //before I send to function parameter int SendedViewID = SomeObject.GetComponent().viewID;
But it doesn't work, because photonView.viewID never equals SendedViewID and I don't know why. I've read a lot of RPC documentation on different sources, but can't understand why photonView.viewID (whis is calling inside RPC function) always equals viewID of sender (not recipient).
Thank you.