Search Unity

Unet Client(send msg) > Server(get local data) > Client(receive requested data)

Discussion in 'UNet' started by Slaghton, Sep 1, 2018.

  1. Slaghton

    Slaghton

    Joined:
    Sep 9, 2013
    Posts:
    139
    Edit: I think im getting good results with targetRPC. I can see the debug msg being fired on the server cmd and then I can see debug msg being fired on my client only. I'll continue playing with it but it appears its doing what I want.

    I'm looking for a way(s) to send a msg from the client to the server to request the server to access some local data and then take the data it received and send it back to the client.

    We can call a [Command] to initiate the server to run a script/function but I haven't tested ways yet to get the results and send them back to the client that initiated the request in a good manner.

    Main use for this is to access something like a character/inventory db stored on the server without letting the client directly interact with it. I got account login with character/inventory/db working using mysql/php but its only lan based and has the clients directly talking to the db which you don't want for security reasons. I'm still fairly new to this so thought I might ask and see if someone can point me in a good direction.

    (Currently looking at NetworkServer.SendToClient or similar to send the information back to client)
     
    Last edited: Sep 1, 2018