x


broadcast network

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.

more ▼

asked Jun 01, 2011 at 12:04 AM

ric_eng gravatar image

ric_eng
21 21 18 20

not sure you can even do it without a server client relationship. functions like RPC only work when connected.

Jun 01, 2011 at 12:47 AM Anxo

can i make a server send a message to all clients? Or even a client tell the server to do this?

Jun 02, 2011 at 08:49 PM ric_eng

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.

Jun 02, 2011 at 08:57 PM Anxo

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?

Jun 08, 2011 at 01:59 AM ric_eng

Connect to a server...?

Dec 13, 2011 at 11:29 PM asafsitner
(comments are locked)
10|3000 characters needed characters left

2 answers: sort oldest

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

more ▼

answered Dec 14, 2011 at 05:29 AM

flamy gravatar image

flamy
5.9k 28 36 72

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, 2011 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, 2011 at 12:24 PM flamy
(comments are locked)
10|3000 characters needed characters left

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?,

more ▼

answered Dec 14, 2011 at 11:21 AM

ric_eng gravatar image

ric_eng
21 21 18 20

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, 2011 at 11:53 AM flamy
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1145
x14

asked: Jun 01, 2011 at 12:04 AM

Seen: 2577 times

Last Updated: Dec 14, 2011 at 12:24 PM