Send By Channel ?

Hello,
I have several channels configured and I need the server to send a message to a specific client using a specific channel. So I’m using NetworkServer to send messages using the SendToAll and SendToClient methods:
http://docs.unity3d.com/ScriptReference/Networking.NetworkServer.html
But the API only offers SendByChannelToAll and SendByChannelToReady. There is no SendByChannelToClient. Is there a workaround for this ? The message is big and I can’t afford sending it to other clients that do not require it.

Okay, so after a lot of browsing and experimenting I came to the conclusion that there is no built-in functonality for sending messages/rpcs to speciffic clients using channels but I managed to do that using the transport layer. It’s the transport layer so it’s not super convenient but thank god for it! If that was the legacy network system I’d be just stuck.

A player object on the server has a connectionToClient member that is a NetworkConnection object. You can call SendByChannel() on that to send a message to just that client.

2 Likes

Oh, this makes things so much easier! Thank you for that information, I don’t know how I’ve missed that