#define for all UNITY

I see in the docs that there are predefined defines for various unity platforms, but I need to switch compilation based on being for UNITY or not.

How can I test for that?

Okay,

So, I was using UNITY_EDITOR. The problem is, that UNITY_EDITOR is not set when you do a build.

It seems that there is no “Im a unity compile” generic define, HOWEVER you can define your own defines that are visible at compile in the player settings. So what i ended up doing is define UNITY there and using that, and now my code compiles correctly in all cases.

Could you be looking for “#if Unity_Editor”?