Sounds easy, right? Find if the Unity Editor process is the currently focused foreground window.
For the love of all that is holy, I can’t find a way to do it.
Sounds easy, right? Find if the Unity Editor process is the currently focused foreground window.
For the love of all that is holy, I can’t find a way to do it.
Uhm. The way I would go about this is using windows APIs, but that wouldn’t be a great production solution.
I tried, can’t even do that. The Managed code, for some reason, doesn’t have a valid MainWindow handle, so I can’t compare it to the current foreground window handle.
You’d find it by process ID, get the main window IntPtr handle of Unity itself.
Yes, I know that, but the MainWindowHandle always returns 0 for some reason with Unity. I’ll look at it again tonight, but I pretty much ran out of idea while using GetForegroundWindow.
I’m pretty sure that doesn’t work in Editor, and it doesn’t trap when the focus is lost.
Any news on this? Didn’t find it too
Just curious. Why do you need to know this?
In my custom editor script, I change the android keystore path to be at the correct location on the machine (in my team several people compile the project). I’d like when I switch to a new window (mostly git) revert this change so it’s not pushed and won’t make conflict.
Isn’t it easier to throw it in .ignore?
Unfortunately a ProjectSettings.asset shouldn’t be ignored at all by the team