Search Unity

get debugger listening port from code

Discussion in 'Editor & General Support' started by KnightPista, Nov 12, 2019.

  1. KnightPista

    KnightPista

    Joined:
    May 18, 2015
    Posts:
    40
    Hi, when you start a development build, you can attach to it using Visual Studio->Attach Unity Debugger.
    There you can find running instances to which you can connect (with their port displayed).

    Is there a way I can get this port from the script code?

    It is useful, when you run multiple instances of development build on a single machine and you want to connect to the one specific instance. If you could detect that port number, you can display that port number on screen or in window title bar, so then you know on which instance to connect.

    Thank you.
     
    Last edited: Nov 12, 2019
    UbiAnthonyB likes this.
  2. UbiAnthonyB

    UbiAnthonyB

    Joined:
    Jun 28, 2019
    Posts:
    4
    Cant believe this isn't answered!