Hello,
Does anybody know the UNET equivalent of
network.RPC(“function”, RPCMode.Owner,…)
I would like my SERVER to be able to call a function on just ONE of the clients, rather than all of them.
Thanks
Hello,
Does anybody know the UNET equivalent of
network.RPC(“function”, RPCMode.Owner,…)
I would like my SERVER to be able to call a function on just ONE of the clients, rather than all of them.
Thanks
You can use messaging instead. This allows you to send an object of type MessageBase to a specific client using NetworkServer.SendToClient. The client needs to have a delegate function registered to receive the message, using RegisterHandler.
RPCs in uNet target all clients for the moment. later on they might consider adding a version which takes a NetworkPlayer or connection list which only sends to them. most of the times however you want to send data to everyone but owner or owner itself so at least these two are very helpful.
Thanks!
Simple case where you want to send only to one client…
Lets say you have multiplayer game like grand theft auto, where one player wants to drive a car that appears in all clients. When the player gets in the car, server can send a message to him only that he now can drive the car. You wouldnt send this message to everyone, since some players may not even be near the car or want to drive.
The observer/visibility system handles this.