Undocumented Unity-controlled Define symbols

I know about platform-specific defines which are documented here:

But today I realized that Unity actually puts a lot more Defines into the Mono project than just those listed on that page. The list of defines in my current C# project I’m working on in Windows is here (This comes from the Compiler options under my Assembly-CSharp mono project):

DEBUG;
TRACE;
UNITY_ANDROID;
ENABLE_MICROPHONE;
ENABLE_TEXTUREID_MAP;
ENABLE_AUDIO_FMOD;
ENABLE_MONO;
ENABLE_SPRITES;
ENABLE_TERRAIN;
ENABLE_GENERICS;
ENABLE_SUBSTANCE;
INCLUDE_WP8SUPPORT;
ENABLE_WWW;
ENABLE_IMAGEEFFECTS;
ENABLE_WEBCAM;
INCLUDE_METROSUPPORT;
RENDER_SOFTWARE_CURSOR;
ENABLE_NETWORK;
ENABLE_PHYSICS;
ENABLE_CACHING;
ENABLE_CLOTH;
UNITY_ANDROID_API;
ENABLE_2D_PHYSICS;
ENABLE_SHADOWS;
ENABLE_AUDIO;
ENABLE_NAVMESH_CARVING;
ENABLE_SINGLE_INSTANCE_BUILD_SETTING;
UNITY_4_3_2;
UNITY_4_3;
ENABLE_PROFILER;
UNITY_EDITOR;
UNITY_EDITOR_WIN

So, I see the defines I expected to see based on the documentation, but there are many many more as well. Now, most of these defines clearly come from Unity as they correspond to Unity features (e.g. - terrain, 2D physics, etc.), but I can find no documentation on them anywhere. It makes me wonder what they would be used for and if there is any way to control them. For example, is there some hidden option to disable terrain if your game doesn’t use that system, possibly reducing build size?

I also noticed that when I tick the “Development Build” checkbox on my Build Settings in the Unity Editor it updates the C# Mono project to also include the DEVELOPMENT_BUILD define. So, it appears that Unity will modify these defines based on settings specified in the Unity Editor.

Does anyone have any insight into any of these extra defines?

1 Like

If there’s no documentation, it would be because they are only used internally to control the options for their rendering pipeline, occlusion system, editor, and other Unity black boxes. Unity would turn them off and on based on your project settings.

If you pay up for a source license, there is probably super secret documentation on all of them Unity would release to you.

I would say that all those ENABLE_* belong to the build stripping and are used internally to compile unitys own engine code…

Just stick to the documented ones. :slight_smile:

Yeah, I’d suspect that they’re undocumented because we’re not meant to mess with them. They’re probably there for internal testing/configuration/deployment pipeline/etc.

But undocumented features make me feel like a hacker! :slight_smile:

:slight_smile: Then doit. But if you have any problems, just hack your way out of them.

1 Like

Heey, maybe I can use this one… It’s really annoying how OnAudioFilterRead will continue playing audio even when you hard disable audio within unity.

These are compile-flags in VisualStudio (Project Properties → Build Tab) and nothing Unity special. These are pretty usefull in non-Unity projects. Since Unity defines “DEVELOPMENT_BUILD” and “UNITY_EDITOR” they’re more or less useless.

Hello everyone.
Now 2022, we can disable Unity Modules, and they are UPM packages, so Instead of undocumented define symbols we can use package version for this Detect if a package is installed? - Unity Engine - Unity Discussions

You mean aside from trying to use something that is undocumented?