Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Unity Multiplayer UNET from LAN to WAN

Discussion in 'Connected Games' started by Edan-Smith, Jun 14, 2018.

  1. Edan-Smith

    Edan-Smith

    Joined:
    Jan 21, 2015
    Posts:
    5
    Hey guys, I'm trying to make my game work in WAN using UNET HLAPI.
    For now, the only way that I was able to make my friend connect to me was by us both using a VPN named "Hamachi" which simulates as if we both were on a LAN.

    So my questions are:
    1 - Do I need to enable the "Bind server to IP" option on NetworkManager?
    2 - If question 1 = yes, should I put the Server/Host external IP in the box that appears after the option is checked? Like "75.398.20.xx" for example.
    3 - Then after all that, the Server/Host has to PortForward with his router + Open ports with TCP/UDP and that is it?
    4 - The port forwarding can be done on the Server/Host router or I do need some 3rd party program like NAT-something installed?

    Current problem: If the server/host tries to host with "Bind server to IP" + their external IP, unity gives an error saying "Cannot open socket on ip {75.398.20.xx} and port {25000}; please check your network, most probably port has been already occupied" even though the port isn't being used and is open.
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    3,584
    You need to enable port forwarding on your router to point the correct UDP port(s) used by your game to the internal IP address which will host the game. Or you can use a relay solution. Or you can use a NAT punch through solution. Or you can set up a dedicated server with a public IP address somewhere. There's lots of threads on these various topics. They are more general networking issues than Unity issues though.
     
  3. Edan-Smith

    Edan-Smith

    Joined:
    Jan 21, 2015
    Posts:
    5
    Ok thanks, we managed to fix it doing something else.
     
  4. lameWorks

    lameWorks

    Joined:
    Feb 8, 2018
    Posts:
    1
    can you please tell what solution you found at the end ?
     
    Edan-Smith likes this.
  5. snair692

    snair692

    Joined:
    Feb 2, 2016
    Posts:
    26
    If you don't want to use port forwarding or NAT punch through then you need an intermediary server or a "Relay" server - UNET is built to work with the Unity Matchmaking and Relay servers -- free to test and dev on but when it gets ready for prime time you will have to pay for that bandwith.