Hi.
I’m quite a newbie with Unity Networking, so please forgive me if this question seems stupid to you, but I’m having a little problem.
I’m trying to make an online game for 2 players only, and I first tried my game locally with Unet from Unity 5. I managed to write that script which connect two people (one is hosting, one is joining).
public class CustomNetworkManager : NetworkManager {
public void StartupHost () {
SetPort ();
NetworkManager.singleton.StartHost ();
}
public void JoinGame () {
NetworkManager.singleton.networkAddress = GameObject.Find("IpText").GetComponent<Text>().text;
SetPort ();
NetworkManager.singleton.StartClient ();
}
void SetPort () {
NetworkManager.singleton.networkPort = 7777;
}
}
StartupHost is called for the player who’s hosting, JoinGame is called for the Client joining the game.
When setting localhost as the network address, all went well. But when I tried to use the IP port instead, nothing happend.
What am I doing wrong ? Network address isn’t the IP address ? Do I need to call StartClient() or setup connections ?