Server Response

Hi!

In this example we saw how to validate the username, but is there a way to send a response back to the client? For instance, if the server rejects the username for being to short, can we tell this reason to the client, or does this check have to be done in the client aswell in order to be prompted?

Thanks in advance!

Hi there, good question!
In theory you could have some feedback sent back to the client. Generally we us the ClientRPC attribute to send a command from the server to run on the client. So if the check meets certain criteria, you could call a ClientRPC method that triggers a message or something on the client.

1 Like

Hello!

Ok I see but shoudn’t this be a TargetNpc call to trigger this only for the client that sent the command?
I thought we needed the NetworkID for this but as I seem to understand with the documentation (https://mirror-networking.gitbook.io/docs/guides/communications/remote-actions#targetrpc-calls), the server keeps track of which client sent which command so if no ID is passed to the TargetRpc, it is executed on the client that sent the command.

Thank you for your answer, it is all clear for me now, I didn’t think that way with Rpc calls!

1 Like

TargetRPC, even better!

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms