- Home /
MonoDevelop no longer getting global Unity defines
Just today I have encountered a really weird problem that I have never seen before. It looks as though when Unity builds the project/solution files for MonoDevelop, it's not inserting any of the expected global #defines -- for example, UNITY_EDITOR or UNITY_4_3. As you might expect, this led to our codebase suddenly ceasing to compile in MonoDevelop (although the project would compile and run just fine in the Unity editor itself).
I managed to work around the problem by manually adding those #defines to the project settings, but that seems to me to be extremely fragile and prone to creating future problems. For instance, if I build to device, does the Unity project use the C# project settings to compile my scripts? Doesn't seem like a good idea to define UNITY_EDITOR on device. Further, I expect that the next time I happen to regenerate the project files, those hand-crafted settings will get stomped and my game won't build again.
Anyone have any idea how this stuff gets inserted into the project by Unity? And, for bonus points, whether the build workflow relies on these project settings in any way.
Answer by TimK.Disney · Mar 19, 2014 at 05:54 PM
Just discovered the answer to this problem today, with the help of a sharp-eyed coworker: I had somehow inadvertently set MonoDevelop into Release mode, and those defines are not part of the project in that mode, apparently. Switching back to Debug mode fixed the problem.
I had the same problem too. Tim$$anonymous$$.Disney's answer worked 100%!
I'd like to add that the same problem also causes PlayerSettings custom defines not being visible to IntelliSense in $$anonymous$$onoDevelop in addition to Unity's automatic global defines for active platform etc.
I just had the same problem. You saved my day. Thank you!!
Amazing. 3.5 years later and this is still correct. No idea how my $$anonymous$$D got switched to Release or why this is still a problem, but there it was. Thanks!