Search Unity

Bug Failing to bind if using UnityTransport.ConnectionData field

Discussion in 'Unity Transport' started by Tramplex, Feb 13, 2023.

  1. Tramplex

    Tramplex

    Joined:
    Dec 10, 2016
    Posts:
    15
    I have an issue when any attempt to bind to any port via Unity Transport (using it in conjunction with Network for GameObjects) leands to failing to bind and shutdown of NetworkManager.
    I've spent last 6 hours debugging everything on my machine down to WindowsAPI calls. I'm glad that i finally understood what was the issue, but it would have been incredibly better if that didn't happen at all.
    What was the deal:
    I have been assigning ip address and port via creating new ConnectionData() and assigning it to UnityTransport component's ConnectionData field.
    When i switched to using UnityTransport.SetConnectionData() it started successfully binding to all ports.
    So what do i want with this post on forums?
    Guys you really shouldn't give access to a field if assigning it breaks things. Or at least warn in comments to it that it may not work correctly.
    So to anyone struggling to make UnityTransport to start: just make sure youre not doing what i did.