Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Resolved Relay: Code Not Found

Discussion in 'Lobby' started by Occuros, Nov 14, 2021.

Thread Status:
Not open for further replies.
  1. Occuros

    Occuros

    Joined:
    Sep 4, 2018
    Posts:
    301
    I'm following the documentation for setting up the relay to have clients connect, and even though I can create relay servers, other clients simply cant join and the relay servers always claim that the join code wasn't found (with selecting regions or without).

    I tried multiple variations, but even the relay sample (where instead of grabbing the join code from a newly created server, I pass in the join code from another build) just doesn't allow me to find the created relay.

    The boss room and lobby example projects work (with selecting the same Organization and Project in the services) so it seems it has nothing directly to do with the backend services.

    Did anyone manage to have the relay working in a simple and minimalistic example?

    I attached the two files I used to set up the relay and which seem to have something missing to make it fully work.
     

    Attached Files:

  2. UnityPeterD

    UnityPeterD

    Unity Technologies

    Joined:
    Nov 5, 2019
    Posts:
    64
    Hi Occuros,

    Thank you for reaching out and apologies for the delay in getting to this. I have taken a look at your attached scripts and I see that you have the method created to request an allocation and get a join code. I also notice that you are joining the allocation as the host, which should not be necessary and is likely causing the host to bind as a client. Without a host binding, the relay allocation is likely timing out before you can establish a connection.

    Running your scripts as you have them here I do encounter the same issue (returns 404 errors). Removing the join request, using the data from your RelayHelper script and setting up a NetworkManager with the transport set to Relay Unity Transport, I am able to set up and join the allocation when integrating this into my own sample project.

    Can you try the above and see if that helps and let me know?

    Kind Regards,
     
    KosmosisDire and JJunior like this.
  3. azcoffeehabit

    azcoffeehabit

    Joined:
    Jun 14, 2015
    Posts:
    25
    This is a very helpful post, after days of searching I came across this after having the same issue.

    I was also making the same mistake of creating the relay as host and then joining the relay as the client. The real connecting client would get a 404 not found.

    By removing the client join from host everything started working as expected.
     
    Unity_Brandon likes this.
Thread Status:
Not open for further replies.