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. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice
Dismiss Notice
Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.

Unity transport + Netcode = Works only on local host (not remote)

Discussion in 'Unity Transport' started by unity_1929999, Jul 21, 2022.

  1. unity_1929999

    unity_1929999

    Joined:
    Jul 20, 2020
    Posts:
    10
    I have a project (Unity 2021.2.6) with Netcode fo gameobjects working with deprecated U Net transport. So, I have no problems with it. But I wanted to change it to modern Unity transport.
    I checked the project Boss room and some others using Unity transport. So, all of them works only on local host 127.0.0.1. But when I build dedicated server version, and send it to remote win server I have big problems. Client hear server but disconnects immediately at first time. At second time I can't connect to server at all (it needs to reboot). What I'm doing wrong?
     
  2. simon-lemay-unity

    simon-lemay-unity

    Unity Technologies

    Joined:
    Jul 19, 2021
    Posts:
    150
    Have you looked at the player logs on the server for any insights into the issue? If you run the dedicated server build on your local machine, can a local client connect to it?

    I'd also suggest setting the listen address on the server to 0.0.0.0 if it's not already the case.
     
  3. unity_1929999

    unity_1929999

    Joined:
    Jul 20, 2020
    Posts:
    10
    Thanks for quick answer!

    Yes, on local machine everything works good. (Windows platform and Dedicated server both)
    Yew, listen address on the server is set to 0.0.0.0.

    No errors are displayed. I just get a Disconnect event after a few seconds.

    I noticed something else. The more I set the Size (Packet queue, Payload, Send queue) in the screenshot, the longer the connection with the server lasts, but everything is within a minute.
    As if something is overflowing and not being cleared...
     

    Attached Files:

  4. simon-lemay-unity

    simon-lemay-unity

    Unity Technologies

    Joined:
    Jul 19, 2021
    Posts:
    150
    Thanks for providing more details. Yes that looks like an overflow of the send queue (when it overflows, we disconnect the connection, which matches what you're observing).

    One situation where that would occur is if the remote server is not processing incoming traffic. Do you have any way of verifying that the server is processing packets? Maybe you could try sending it a few RPCs once the connection is established and have the server log something when the RPCs are called.

    This could also be caused by something on the client sending more reliable traffic than the server is able to process. Is there perhaps something that's sending more traffic than necessary to the server? Also, what version of Netcode for GameObjects are you using? We've had similar reports of overflowing queues on the latest version, and I'm starting to wonder if we may not have a bug in there...

    As a last suggestion, I'd recommend verifying the quality of the connection to the server (a very high ping and/or a lot of packet loss could cause reliable traffic to back up in the send queues). I'd also suggest ensuring you're not adding packet loss or delay through the debug simulator, but I see from your screenshot that these values are already zeroed out.
     
  5. unity_1929999

    unity_1929999

    Joined:
    Jul 20, 2020
    Posts:
    10
    Thank you, Simon for ideas
    Update:
    1) I used the newest version of Netcode 1.0.0. Now I have checked the previous versions = result is the very same.
    2) I have checked communication on my local net starting host on laptop and client on desktop. Everything works well.
    I think the problem is with the remote server... But it's strange why U net transport works well on it
     
  6. unity_1929999

    unity_1929999

    Joined:
    Jul 20, 2020
    Posts:
    10
    Problem solved. I just changed the server provider of VDS... Everything works both via Unity transport & U net
     
    simon-lemay-unity likes this.