- Home /
Passing variables from client to server
Well, I made a thread a few days ago but I think THAT problem in particular was a little bit confusing, so people couldn´t help me... So i want to ask a simple question, so I can get to work and try to solve it myself...
"How can I pass a variable (string) from client to server in an online game?"
Im trying to use RPCs but I dont think I understand them very well since nothing I try works...
Answer by KiraSensei · Jun 28, 2013 at 04:30 PM
RPCs are the solution.
You need to attach a network view to a game object (your player for example). Then in a script attached to the same game object you can call a RPC function (see the doc and tell as an argument to who you want to launch the function (the RPCmode.Server in your example), and then a second argument, your string.
The function must exist in the script attached to the game object AND in a script attached to a game object on the server side.
Your answer
Follow this Question
Related Questions
Building my own benchmarking program 1 Answer
How to Reduce the lag? 3 Answers
How many polygons- pc MMORPG 1 Answer
Instantiate a prefab inside a parenting GameObject 1 Answer
Android Button 3 Answers