Photon Unity
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on PUN.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
Photon Unity : Send an RPC Function to one specific player to execute.
Mido135
2020-06-23 20:14:32
i just want to know how to send an rpc function to one player using Raycast, i looked up for tutorials but cant find any , i would appreciate it if someone can explain to me how, thanks in advance.
Comments
Haven't done it and just typing code from memory... but something like this should work inside your Raycast block:
var hitPhotonView = hit.collider.gameObject.GetComponentInParent<PhotonView>();
if(hitPhotonView != null)
photonView.RPC("RPCName", hitPhotonView.owner);
thanks for responding, so when the owner execute this function, will his health for example be sycronized with all other players even if we don t use RPCtarget.all .
The health would always be calculated locally meaning, Player B doesn't need to know the health of Player A. Player A tags damage then anything thing resulting from that would be replicated over the network, such as death or specific animations.
Are you referring to UI when you talk of synchronized health?
Back to top