- Home /
RPC Mode set at ALL but only sender executes function
I was creating a simple chat script. Here is what it is:
if (GUILayout.Button ("Send") && chat != "") {
networkView.RPC ("PrintText", RPCMode.All, chat, username);
chat = "";
}
Once the button is clicked it sends a message to call the PrintText funtion:
@RPC function PrintText (text : String, namez : String)
{
log+= "<" + namez + "> " + text + "\n";
}
log here is a GUI Label.
But only the sender can see what he typed. He cannot see what others typed. Why so?
Just a $$anonymous$$or off-topic comment: Avoid using + on strings as it may produce redundant garbage since strings are immutable and create new (temporary) strings. http://www.csharp411.com/strings-dont-add-up/
Strings are immutable in C#, right? But this is done in Javascript.
Answer by ni5khi5l · Apr 17, 2011 at 01:36 PM
The problem was that Network View was not attached to Server file.
Your answer
Follow this Question
Related Questions
Problem with Network Connection 1 Answer
Unity NetworkViewID Collision problem 0 Answers
Unity crashes when doing an RPC. 1 Answer