More precisely, I would like to know what must be modified in the ConnectGUIMasterServer.js script of Unity's networking example to have it work reliably with a home-hosted master server, whatever the players' locations (LAN or external).
A home hosted master server might be a little troublesome. One of the things the master-server helps you with is NAT punchthrough - which requires that the machine the master-server is running on has a direct connection to the Internet, which usually is not the case for "home-based server".
So, unless you've got an Internet provider that gives you a public IP for your specific server and unless you have that server directly connected (without any IP-forwarding or NAT), it'll be hard to get connections created through such a home-based master server to be reliable.
That said: You can use MasterServer.ipAddress and MasterServer.port to let Unity know the data of your local MasterServer. Just make sure this is done before you actually use the MasterServer (e.g. for connecting), so you'd probably put the relevant statements right in the beginning of ConnectGuiMasterServer.js; something like:
private var testMessage = "Undetermined NAT capabilities";
// Enable this if not running a client on the server machine
//MasterServer.dedicatedServer = true;
// => this is added START
MasterServer.ipAddress = "127.0.0.1"; // your public IP-address
MasterServer.port = 12345; // the port your master-server uses (or leave that out if you use the default port)
// END until here ;-)
function OnFailedToConnectToMasterServer(info: NetworkConnectionError)
{
Debug.Log(info);
}
If you want to make it accessable to the outer world and would like to use one of the free static domain redirectors for that (no-ip.org / dyndns), then you need to expand the code slightly, as the ipAdress property of the master server etc only accepts the regular tupples.
Also, you can not only set the master server adress and port but also the one of the connection tester and facilitator, which you will have to host along with the master server, should you require these functionalities.
The connection tester will obviously handle the connection test, while the facilitator is used for the NATPunchthrough.
Here is an example