I have a script that I like to run on Windows/Mac in Unity Editor,
which is truly platform dependent. I found that UNITY_EDITOR will be effective for both platforms, but there is no obvious way to tell if I’m running the editor on Windows or Mac.
I needed to do this, but couldn’t find anything in Unity itself, so ended up using a .NET Framework API. Below is the code I use, which is based on the code in the answer to the “How to detect the execution platform?” question in the Mono technical FAQ. It returns false on Windows and true on Mac (and other Unix-like OSes):