Are there #defines for conditional compilation based on the build configurations?

I would like to set up a few macros and have the compiler ignore them if the game code isn’t built for debugging. I tried to make use of #ifdef and #if for UE_BUILD_DEBUG, DEVELOPMENT, and SHIPPING, but did not get results that I could use. No matter what configuration I set, the DEBUG macros were never used. DEVELOPMENT was used for everything except when I set the configuration drop-down to Shipping.

Background Information: I did not compile the engine from github, I just used the version downloaded by the launcher. I started the project based on the 3rd Person C++ sample. My end goal is just to have some customized assertion macros that go away for non-debug builds. I tried using the check() macro, but it fired the assertions in every single build configuration, even Shipping.

Is there a different set of #defines I should look for? Or is there a different way that I should be approaching this issue?

I have been looking at how to do this as well. The Build.h has a list of macros that have been defined, but I am still trying to understand them.

Personally, I have been trying to wrap a function (UFUNCTION with exec for console control) in one of those #defines to make sure they only work when I am developing and not when I am shipping. It doesn’t work when I use the PIE.

To get around it, I defined my own macros.

Are they macros that you have to undefine manually? Or were you able to find a way to activate them based on the build configuration you chose? I set up a couple macros to turn on and off functionality, but I have to manually go back and change them when I want to toggle back and forth.

As of now I am doing them manually in a header file of my own, which is painful. I will try to find a better way once I have more time to investigate.

Okay. Yeah that was the only solution I had time to come up with as well. It’s less than ideal, but it gets the job done I suppose. Thanks for the post! If anyone on my team finds an easier method, I’ll update here as well.