Keep Your Projects Tray Icon Visible! Despite What Microsoft Says!
So, This isn't Unity Specific but you can use it in Unity if you have a tray icon. I use this in my Unity project's launcher which is written in JAVA. So I will demonstrate this using JAVA. But it can be used from anything that has a process launcher including Unity direct although I have never instantiated a tray icon from Unity directly so.
My JAVA launcher creates a tray icon that needs to be visible. It can not be hidden with inactive icons. Windows 10 by default will show your icon in the active icons area ONLY the first time you ever use an app. After that it gets added to your registry file under iconstreams with a value of 1 which means inactive.
We want to achieve a state of 2, which means user set to active. How can we achieve this? Microsoft has explicitly stated they do not want us having this functionality and it is a choice that is up to the user. But even as a power user, I hate setting icons to active and my usual response is just click show all when I want icons to show. I'm lazy....
So this script will search through all registry entries in this area looking for the keyword. I would typically recommend you simply search for yourapp.exe (case sensitive) but you can also do some fun tricks if you know how. In my case I have embedded the word NANOCHEEZE in all caps into my app so that it gets saved in that registry value. This allows my to search for the keyword NANOCHEEZE instead of nanocheeze.exe and this will find all instances of my app, including any that may have been run from a .jar or from java.exe vs javaw.exe or my actual distribution version which is nanocheeze.exe as I said.
The trick is to use a power shell script and to over ride policy and security settings of power shell. Very simple...
And for the code to this: