Search Unity

Is it possible to connect a WebGl Unity build to a C# server using UNet?

Discussion in 'UNet' started by Maccyfin, May 7, 2020.

  1. Maccyfin

    Maccyfin

    Joined:
    Aug 19, 2012
    Posts:
    87
    Hey guys. So here's the scenario:

    - I have a WebGL Unity build running in a browser.
    - I have a server running on a machine which is built using raw C#.
    - Can I connect to the server using the Unet system? Or does the server also need to be built using Unity?


    - I know its possible using Websockets and javascript as a plugin, but I wanted to check this point above first.

    Thanks for any help all :)
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    The main Unity dev working on the Unet LLAPI developed a DLL for use it in projects outside of Unity to use Unet to talk to a Unity project. But Unet was deprecated years ago, so it might be hard to get this late in the game, since you had to request the DLL from Unity for your project's use. It wasn't just posted for general availability for some reason (probably licensing or something). I didn't follow the DLL development close enough to remember this many years later if it specifically supported websockets in addition to UDP, but investigating those old threads would be where I'd start.

    Choosing Unet right now is probably a mistake by the way. I'd look for any other solution.
     
  3. Maccyfin

    Maccyfin

    Joined:
    Aug 19, 2012
    Posts:
    87
    Hey Joe. thanks for the reply.

    Yeah I'd heard Unet was being deprecated. So it sounds like using a javascript websocket plugin is the better, more stable way to go for WebGL server client communication.

    I assume with the new 'Connected Games' multiplayer solution, that would also require the server to be built in Unity?
     
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Last I read the in development network solution from Unity doesn't have WebGL support, and won't have it in the near future.
     
  5. Maccyfin

    Maccyfin

    Joined:
    Aug 19, 2012
    Posts:
    87
    Ah ok. Then it sounds like websockets in a WebGL build is going to have to be the way for sure.