How to exclude debug code when shipping game

Hello guys,

I would like to ask how can I exclude debug code like GEngine->AddOnScreenDebugMessage() during shipping. I use this kind of debug messages in my project, however I would like to be sure that these will not be displayed in shipped buiild. I prefer some macros because generated code will be cleaner and will not contain conditions and code that will never run.

There a definition flags like UE_BUILD_SHIPPING or UE_BUILD_DEBUG, each build configuration has it. So:




Will build that code only on debug config build, or




Will compile this code on everything other then shipping build config


Thank you for your help, that is exactly what I was looking for.

Are there any pre-processor defenitions for server / dedicated server as well?

Yes UE_SERVER if dedicated is compiled or WITH_SERVER_CODE if game should have server code at all

I just find this header file with most of defines

1 Like