Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved Getting QoS Region IDs on WebGL

Discussion in 'Matchmaker' started by MarcoZVincenzi, Oct 12, 2023.

  1. MarcoZVincenzi


    Mar 3, 2022
    Before my client tries to connect to a Unity Multiplay Server, I'm trying to collect its Quality of Service data in order to add it to the Matchmaking Ticket. How exactly can I do that in WebGL?

    After reading the (quite scattered, frankly) documentation, I assume the workflow to get the necessary data would be:
    1. Get the target Fleet ID.
    2. Get the QoS for servers on to that Fleet relative to the calling client.
    3. Add the QoS results to the ticket (with the region ID formatted as "75721794-e9fd-4d8a-9879-aa853ed18885", and not as something like "eu-west").
    Step 1 already gives us a few head-scratchers. Unless we hardcode the IDs into the project, how can a client retrieve them? API calls to List Fleets require a Service Account, so clients would be unable to use them.

    Step 2 is also difficult to achieve. The method GetSortedQosResultsAsync() is not available as the QoS Package doesn't seem to work in WebGL (the picture below is what we get on 2022.3.10 LTS).

    API calls to get the QoS data are available, like get-service-servers, but they either require the region as a parameter, or simply return the name of the region ("eu-west"). There may be other options available if a client was already connected to a server, but we still need to connect to one first.

    Basically, is there a way to actually retrieve region IDs as a WebGL client?
    JayHuangYC likes this.
  2. guillaumedUnity


    Unity Technologies

    Apr 1, 2021
    Hi ! This is not supported in WebGL due to the limitation of running inside a browser.
    The best option for WebGL would be tu use a region selector in the game.
    Sending dummy QoS Result in the ticket for that specific region would create a server in that specific region
    MarcoZVincenzi likes this.