IP

So the multyplayer example unity has, it has this script. So what ip would you use to connect to the server? Could someone explain this to me? And also explain the remote and listen ports. Also could I connect to someone thats not on my local area network with this?
Thanks

//DontDestroyOnLoad(this);
var remoteIP = "127.0.0.1";           <  This line here
var remotePort = 25001;          <  This line here
var listenPort = 25000;          <  This line here
var remoteGUID = "";
var useNat = false;
private var connectionInfo = "";

function Awake() 
{
	if (FindObjectOfType(ConnectGuiMasterServer))
		this.enabled = false;
}

function OnGUI ()
{
	GUILayout.Space(10);
	GUILayout.BeginHorizontal();
	GUILayout.Space(10);
	if (Network.peerType == NetworkPeerType.Disconnected)
	{
		useNat = GUILayout.Toggle(useNat, "Use NAT punchthrough");
		GUILayout.EndHorizontal();
		GUILayout.BeginHorizontal();
		GUILayout.Space(10);

		GUILayout.BeginVertical();
		if (GUILayout.Button ("Connect"))
		{
			if (useNat)
			{
				if (!remoteGUID)
					Debug.LogWarning("Invalid GUID given, must be a valid one as reported by Network.player.guid or returned in a HostData struture from the master server");
				else
					Network.Connect(remoteGUID);
			}
			else
			{
				Network.Connect(remoteIP, remotePort);
			}
		}
		if (GUILayout.Button ("Start Server"))
		{
			Network.InitializeServer(32, listenPort, useNat);
			// Notify our objects that the level and the network is ready
			for (var go in FindObjectsOfType(GameObject))
				go.SendMessage("OnNetworkLoadedLevel", SendMessageOptions.DontRequireReceiver);		
		}
		GUILayout.EndVertical();
		if (useNat)
		{
			remoteGUID = GUILayout.TextField(remoteGUID, GUILayout.MinWidth(145));
		}
		else
		{
			remoteIP = GUILayout.TextField(remoteIP, GUILayout.MinWidth(100));
			remotePort = parseInt(GUILayout.TextField(remotePort.ToString()));
		}
	}
	else
	{
		if (useNat)
			GUILayout.Label("GUID: " + Network.player.guid + " - ");
		GUILayout.Label("Local IP/port: " + Network.player.ipAddress + "/" + Network.player.port);
		GUILayout.Label(" - External IP/port: " + Network.player.externalIP + "/" + Network.player.externalPort);
		GUILayout.EndHorizontal();
		GUILayout.BeginHorizontal();
		if (GUILayout.Button ("Disconnect"))
			Network.Disconnect(200);
	}
	GUILayout.FlexibleSpace();
	GUILayout.EndHorizontal();
}

function OnServerInitialized()
{
	if (useNat)
		Debug.Log("==> GUID is " + Network.player.guid + ". Use this on clients to connect with NAT punchthrough.");
	Debug.Log("==> Local IP/port is " + Network.player.ipAddress + "/" + Network.player.port + ". Use this on clients to connect directly.");
}

function OnConnectedToServer() {
	// Notify our objects that the level and the network is ready
	for (var go in FindObjectsOfType(GameObject))
		go.SendMessage("OnNetworkLoadedLevel", SendMessageOptions.DontRequireReceiver);		
}

function OnDisconnectedFromServer () {
	if (this.enabled != false)
		Application.LoadLevel(Application.loadedLevel);
	else
		FindObjectOfType(NetworkLevelLoad).OnDisconnectedFromServer();
}

Listen Port: Port for the server to listen for new connections, once a connection is made, the client and server negotiate a one on one connection and things continue from there.

Remote Port: If you are going to connect as the client to the server, this is the port on the other computer you would hit. In the case where the same computer is the server and the client. It is typical to use 127.0.0.1 as your connecting to address(the server) as this is a reserved IP Address for a local machine.

If you are going to do client and server debugging on the same machine then the IP Address is going to be 127.0.0.1, remote and listen port are going to be the same.

Unity’s Network reference guide.

Just my two cents.

Hey! Thank you a lot! Also like I asked, could this work from 2 computers not in the same network?

Ohh also this doesn’t really have to do with the IP stuff. But this has to do with my multiplayer. The movement script works but it seams to control all players on the server. How can I make it so it only controls your own character. (The player has a network view on it)

var projectile: Transform;
var gun : Transform;
var player : Transform;

function Start () {

}

function Update () {

 if (Input.GetKey(KeyCode.W)){
    player.Translate(Vector3.forward * Time.deltaTime * 2);
		}
		if (Input.GetKey (KeyCode.A)){
 player.Translate(Vector3.left * Time.deltaTime * 2);
		}
		if (Input.GetKey (KeyCode.S)){
    player.Translate(Vector3.back * Time.deltaTime * 2);
		}
		if (Input.GetKey (KeyCode.D)){
 player.Translate(Vector3.right* Time.deltaTime * 2);
		}
		
		
	
    }
}

Yes it could, but you would need to let the other person/computer know your public IP address in that case. Google will tell you if you ask it, click here.

Thank you a lot landern! And also how do I let the other computer know my public ip? Wouldint they just type in mine? Or do you just mean tell them your IP?