Basic RPC Questions
Options
For some reason I'm having a very hard time understanding RPCs. I've read a bunch of RPC threads and couldn't find what I was looking for. I'm sure the answer is very obvious so bear with me!
So far with RPCs- What I understand is that I can use it to show changes for my current player when called. For example if I have an RPC function that makes a big red dot show up over my head, I can call a function that might look like this:
(This is just a mockup, it's probably got errors lol)
So far with RPCs- What I understand is that I can use it to show changes for my current player when called. For example if I have an RPC function that makes a big red dot show up over my head, I can call a function that might look like this:
(This is just a mockup, it's probably got errors lol)
void Start() { photonView.RPC("ShowDot",PhotonTargets.All); } [RPC] void ShowDot() { dotObject.SetActive(true); }So then everyone (except the player unless they call ShowDot() on it's own), can see a dot over your player's head. I'm at this point where I can comfortably show the player's data- whether it's to a certain group of PhotonTargets or a single PhotonPlayer. BUT, here is where I'm lost. What do I put if I want to change someone else's variables/data? How can I make them call ShowDot() but instead of on the player, they call it on themselves. I would like it if a player's actions can make another player call their own methods. I tried to use an RPC for that too, it would call an RPC that tries to find the current player's photonView, but that did nothing. I'm at a loss on how I can redirect the target if the target will always be whoever called the RPC.
0
Comments
-
Nevermind, I figured it out. I found multiple answers but the way they described it was confusing me. They said that where the RPC is being called is who calls it, but I didn't realize they meant the actual method, not the photonview.RPC.0