Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Can't communicate between two Unity instances using Unity Transport

Discussion in 'Unity Transport' started by rchapman, Sep 30, 2022.

  1. rchapman

    rchapman

    Joined:
    Feb 13, 2014
    Posts:
    105
    I'm trying to write a simple transport layer to connect two Unity projects. I've followed the code samples verbatim here:

    https://docs-multiplayer.unity3d.com/transport/current/minimal-workflow

    This code works fine in both Unity instances when client & server are both running on the same instance. However I cannot get the two sides to communicate. I thought it might be a firewall issue, but I have completely disabled my firewall and still nothing.

    One thing that's very strange is the traffic pattern when I watch Wireshark. If I run the sample in Instance 1 I see all of the traffic bound for port 9000. If I run the sample on Instance 2 (identical code, same ports, etc.) I don't see any traffic in Wireshark. It's almost as though the second instance is running on a completely different network even though I'm using loopback.

    Looking for any help to navigate this--maybe some additional firewall settings I'm not aware of? But firewall settings are app-dependent for the most part and I can't imagine how two instances of the same Unity editor would behave differently. Are there any other settings in Unity Transport or Unity more generally that might cause this?
     
  2. rchapman

    rchapman

    Joined:
    Feb 13, 2014
    Posts:
    105
    Just tested in a third project and the two sides communicated without issue. Must be some setting or configuration in Instance 2 above. Any thoughts for what configurations might affect this?
     
  3. rchapman

    rchapman

    Joined:
    Feb 13, 2014
    Posts:
    105
    Answering my own question in case anyone else is smashing their head against the wall: I'd been testing with the WebGL build target and forgot that Instance 2 was still configured for WebGL. Works now!
     
  4. simon-lemay-unity

    simon-lemay-unity

    Unity Technologies

    Joined:
    Jul 19, 2021
    Posts:
    427
    Thanks for answering your own question once you resolved the issue.

    Reading your messages it's pretty obvious there's something to improve on our end when targeting WebGL. We should make it more obvious that communications to other processes will fail in that situation. I'll file something on our end to address this.