Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Resolved How to use NGO with WebGL ?

Discussion in 'Unity Transport' started by MelvinEPITECH, Jun 5, 2023.

  1. MelvinEPITECH

    MelvinEPITECH

    Joined:
    May 28, 2023
    Posts:
    1
    Hi ! I'm trying to deploy a multiplayer karting game on a React web app with WebGL, and I find the official documentation quite poor on the subject. I'm using Netcode for game objects, and from my understanding NGO's basic unity transport don't work on browsers. Is that correct ? If so, what can I do to keep using NGO ? I saw that there are community transport libraries (https://github.com/Unity-Technologies/multiplayer-community-contributions/tree/main). The websocket transport should work on a browser, right ? If so, is downloading the websocket transport package and changing my network manager's transport protocol to "websocket" all I need to do ? I'll be very grateful for any help/insight, thank you !
     
  2. simon-lemay-unity

    simon-lemay-unity

    Unity Technologies

    Joined:
    Jul 19, 2021
    Posts:
    441
    The default transport (Unity Transport) supports WebGL, but only starting with its 2.0 version. This is only available starting with Unity 2022.2. If you're on that version (or later), then you simply need to install the 2.0 version of the
    com.unity.transport
    package (latest version as of writing this is 2.0.2) and check the "Use WebSockets" checkbox that will have appeared under the Unity Transport component in the editor. If using Unity Relay, you also need to use "wss" as the connection type when creating the Relay server data (instead of "udp" or "dtls").
     
    shochetman, DevDunk and tjumma like this.
  3. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    1,008
    This is wildly critical information - can this be front and center of *all* demo READMEs relating to NGO, @simon-lemay-unity?

    PS: I also noticed you folks have demos that exclude consideration for headless servers, such as boss battle, causing breaking bugs. There's also no native "Start on headless server" like *all* your competitors have (FishNet, Mirror, Photon....). Can you add this and backport it into the demos to support headless servers?
     
  4. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    1,008
    @simon-lemay-unity Hmm, I found inconsistencies in your instructions:

    upload_2023-8-16_16-8-17.png

    The max ver is only 1.3.4 in Unity 2022.3 LTS?
     

    Attached Files:

  5. simon-lemay-unity

    simon-lemay-unity

    Unity Technologies

    Joined:
    Jul 19, 2021
    Posts:
    441
    Version 2.0 is not part of the editor's package manifest yet. You can install it directly however. If you click the small plus icon top-left in the package manager window, then click "Install by name" you can manually enter the version of the package you want to install. Alternatively, you can just edit the manifest.json file to update the version of the package to 2.0.2.
     
  6. simon-lemay-unity

    simon-lemay-unity

    Unity Technologies

    Joined:
    Jul 19, 2021
    Posts:
    441
    Boss Room is a sample for a client-hosted game. It is not meant to showcase deployment to headless servers. Also, what do you mean by "native start on headless server"? Unity supports a dedicated server build target that will create a build of your application for headless servers. And to start a server-only instance with Netcode for GameObjects, you only need to use
    StartServer
    instead of
    StartHost
    .
     
  7. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    1,008
    A dedicated server will include -batchmode -nographics, but has nothing to do with starting a NetworkManager server. All your competitors have this feature to start a NetworkManager server automatically when a headless build (#if UNITY_SERVER) is detected, so folks have to build their own `-arg` handlers and start it manually. Reinventing the wheel defeats the purpose of using NGO instead of, say, FishNet or Mirror that seem years ahead of NGO.

    NGO just feels like there's just no polish, no UX, and no scout of what the competition has already had for the past 6 years (respectfully, but factually, just asking me what is "auto start server on headless" reinforces these words).

    Then the fact that the boss battle game (or ANY ngo demo) has no thought about headless servers for a networking solution just really seems unprofessional to me and screams a red flag of releasing an alpha status product too early. The fact that they don't even have documentation mentioning in a single sentence that headless builds aren't supported (which feels laughable for a networking solution - an official one, at that) is another red flag; how is this not even a thought?

    You know what else had these red flags? UNET. I think Fishnet is the way to go.
     
    Last edited: Aug 23, 2023