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. 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.
    Dismiss Notice
  3. 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

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:
    87
    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:
    87
    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:
    87
    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:
    150
    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.