Quantcast
Channel: Photon Unity Networking (PUN) — Photon Engine
Viewing all articles
Browse latest Browse all 8947

Say another target what to do.

$
0
0
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.

Viewing all articles
Browse latest Browse all 8947

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>