- Home /
UNET - Trigging an action on one client from the server
So I've been stumped on this issue for a while now. Basically I'm trying to send a RPC to a single client. Like when a player damages another, I'm trying to have the server send the data to the client who attacked, and render some text on their screen with the info.
I've tried a plethora of different things, and a ton of googling, but I just can't figure it out. The last thing I tried using was NetworkServer.SendToClientOfPlayer, but I couldn't really get it to work. I'd post the code but it's just a disaster because of all the crap I've tried.
Does anyone happen to have an example on how to do this? I'd really appreciate it. The closest example I've found is this, but it doesn't seem to be exactly what I'm looking for. http://forum.unity3d.com/threads/rpcing-to-a-specific-client.334293/#post-2164146
I've also gone over this page quite a few times, but I'm still having trouble grasping it. http://docs.unity3d.com/Manual/UNetMessages.html
What these tutorials. They're ok.
I've watched nearly that entire series, did I happen to miss something in there?
Did you figure this out because I have the same problem. I cant believe unity has all this fancy functions but doesnt allow the server to call back the client who send it a command.
This is basically what I ended up doing, probably a better way to do it, but it works. Call the command function from the desired client. I also added comments explaining my understanding of it. http://pastebin.com/is$$anonymous$$i4Nba
Your answer
Follow this Question
Related Questions
Rpc is received by client but Cmd is not received by server 2 Answers
How to fix "ClientRpc call on un-spawned object" error, using UNET 2 Answers
Photon (PUN) Type Serialization Error on RPC 2 Answers
Missing @RPC attribute error while it is there. 1 Answer
Networking: Standalone Simulation Server 0 Answers