I am developing apps with Unity 3D, and often have several instances of the program open. When I go to debug my scripts, Monodevelop (the script editing and debugger tool) shows me a list of all open Unity applications and their Process Identifiers (PIDs), so that I can choose which one to attach to.

Pick a Unity, any Unity!

Unfortunately, I often have no idea which PID belongs to the instance of Unity that is running the scripts I wish to debug.

Is there a way to:

  • put the PID in the title bar of the application?
  • see the PID and text on the window's title bar, in some helper application?
  • select an application by PID an bring it to the foreground?

I have tried:

  • looking at the applications in System Preferences -- they all show up as Unity (and quitting them one by one is hardly ideal)
  • running ps auxww | grep Unity -- they were launched with the same path and command so I can't tell them apart
  • dabbling with AppleScript -- I suspect the answer might lie here, but I find it a very confusing language
  • This is probably better placed in stack overflow – Kevin Grabher Dec 3 '17 at 10:33
  • Would it help to have the PID of the process whose UI is active at that moment? I. e., tell app "System Events" to get (process 1 whose frontmost is true)'s unix id – Synoli Dec 3 '17 at 12:58
  • @Synoli, it absolutely would. (I see that script has potential, but I don't know how to run it without Script Editor being in the foreground). – Clinton Blackmore Dec 3 '17 at 17:24
  • @Kevin, I suppose I could try there, but this isn't actually a programming question and thus I thought it fit in better here. I was really hoping there might be a handy little application that'd show the PID of each window in the title bar of the window, but, maybe the problem is too obscure to have a solution like that. – Clinton Blackmore Dec 3 '17 at 17:26
  • Does this help you out? superuser.com/questions/902869/… – Kevin Grabher Dec 3 '17 at 18:32

You must log in to answer this question.

Browse other questions tagged .