Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Unet server tut?

Discussion in 'Scripting' started by mholmes, Dec 24, 2020.

  1. mholmes

    mholmes

    Joined:
    Dec 8, 2012
    Posts:
    407
    I want to build a simple server for chat. Problem is how will people connect to it? I found tuts for server client using a lan but what about wan? Meaning connecting to our servers? Anyone have a simple tutorial for building dedicated server that clients send data too?
     
  2. mholmes

    mholmes

    Joined:
    Dec 8, 2012
    Posts:
    407
    Been doing research on this, does unity support building a dedicated server to connect to using Unet? Or do I need to build my server in Visual Studio as a console app and use unity client to connect to it that way? So far not been able to find a dedicated server tut that uses Unity building a dedicated server that clients connect too. Trying to build a simple dedicated server for text chat so players in game can talk to each other.
     
  3. Omniglitch

    Omniglitch

    Joined:
    May 29, 2017
    Posts:
    37
    Quickly googling "unet server tutorial" the first result yielded a very promising tutorial: https://noobtuts.com/unity/unet-server-hosting

    It explains how you can set up a headless server using Unity and UNet.

    As for the difference between a LAN and a WAN, there's no difference in how you code it. The client simply connects to an IP address. If the server doesn't have a public IP address, but rather a local address like 10.x.x.x or 192.168.x.x, then you just have to set up port forwarding on the router (or it may already be set up if you're using a rented server).
     
  4. csofranz

    csofranz

    Joined:
    Apr 29, 2017
    Posts:
    1,556
    I'm sure that your research has turned this up already, so just to make sure you are not disappointed:

    UNet is deprecated and slated to go the way of the Dodo within the next 12 Months...
     
  5. mholmes

    mholmes

    Joined:
    Dec 8, 2012
    Posts:
    407
    Ooh everything g I found on unet was only 2 years old and replaced photon. Whats the replacement thanks for sharing btw
     
  6. Omniglitch

    Omniglitch

    Joined:
    May 29, 2017
    Posts:
    37
    It looks like going forward Unity will have two integrated networking solutions: MLAPI for the object-oriented approach, and DOTS-NetCode for the data-oriented approach. Of course you can always use one of the many 3rd party solutions as well, like Photon PUN2, Mirror, SmartFoxServer, SocketClass, LiteNetLib, DarkRift Networking 2, or TNet.
     
  7. mholmes

    mholmes

    Joined:
    Dec 8, 2012
    Posts:
    407
    I found a series
    LLAPI. Not sure if that's the most current but looks promising. I'm a .Net dev so I try to, suggestions?
     
  8. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    I'd suggest not learning the Unet LLAPI, since it was deprecated a long time ago.