|
Hello everybody, I would like to know how to send a message to all network applications(unity of course ), such as a P2P? Without a structure for client and server.
(comments are locked)
|
|
I had to follow creating a server, but the bad part is that whenever the need for the client server IP. Would make the client scan the network looking for a server and then find the IP connection and ask him?, if u dont want the user to enter ip everytime use "MasterServer", it will poll the host ip online and would enable it to access it from anywhere, but this would make ur game require internet facility! if u dont want this to go online, u have to maintain the masterserver locally, for which u can download the source code and all setup instruction from unity website free!
Dec 14 '11 at 11:53 AM
flamy
(comments are locked)
|
|
host a server first and make the peers connect to it Network.Conenct then call this rpc after connecting!! if u r already calling connect check for the errors messages! and also add if((Network.isServer)||(Network.isClient)) before ur Rpc call in update. I would suggest u to take a look into some basic network tutorials like this Sorry, i didn't understand it "for which u can download the source code and all setup instruction from unity website free!" how can i do it?
Dec 14 '11 at 12:05 PM
ric_eng
for the masterserver! take a look at this page http://unity3d.com/support/documentation/Components/net-MasterServerBuild.html for buildin masterserver and this page for download! http://unity3d.com/master-server/index.html
Dec 14 '11 at 12:24 PM
flamy
(comments are locked)
|

not sure you can even do it without a server client relationship. functions like RPC only work when connected.
can i make a server send a message to all clients? Or even a client tell the server to do this?
yes, Its called RPCs. It works kind of like Broadcast message but requires a few extra steps. It allows you to send the command to Execute a function, send Strings, Vector3s, floats and int. you can send as many as you want so its very useful.
Team, i did it: 1ª Created one game object 2º Add networkview from component- miscellaneous 3º Created script
function Update() { networkView.RPC("print", RPCMode.All, "go!"); }
@RPC function print(text : String) { Debug.Log(text); }
4º Attached script in gameobject 5º Build & Run 6º Execute in Unity Editor.
Result on console : "Can't send RPC function since no connection was started."
What can i do to work?
Connect to a server...?