Announcement

Collapse
No announcement yet.

How can I exclude debug code in shipped build ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How can I exclude debug code in shipped build ?

    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.

    Thank you

    (I wanted to post this to AnswerHub however I get internal error 3 times)

    #2
    I think you can use:

    #ifdef UE_BUILD_DEBUG

    Comment


      #3
      Thank you very much, that is what I was looking for.

      Also I found my AnswerHub question (for some reason it was created even after internal error).

      https://answers.unrealengine.com/que...ping-game.html

      Comment


        #4
        It is strange but I am not able to get it work. It looks like UE_BUILD_DEBUG is not used in any configuration. I use downloaded binary version and available build configurations are:

        DebugGame
        DebugGame Editor
        Development
        Development Editor
        Shipping

        I use DebugGame Editor for debugging and UE_BUILD_DEBUG is always 0.
        I think this is similar issue: https://answers.unrealengine.com/que...ml?sort=oldest

        EDIT: I think I found reason: https://answers.unrealengine.com/que...-developm.html. It looks like I will need to make custom macro for DebugGame Editor.
        Last edited by nonder; 08-11-2014, 07:06 AM.

        Comment


          #5
          #ifdef UE_BUILD_DEBUG
          This will cause compilation errors. Use #if UE_BUILD_DEBUG instead. The reason is that #ifdef returns true for #define UE_BUILD_DEBUG 0, since it is defined, just to the value zero.

          In general, at Epic we use #if !UE_BUILD_SHIPPING (not shipping).

          Comment


            #6
            There are some useful macros that can come in handy many times like:

            #if UE_BUILD_TEST
            #if UE_BUILD_DEVELOPMENT
            #if UE_BUILD_DEBUG
            #if UE_BUILD_DEBUGGAME

            among others.

            Cheers,
            Moss
            Sr. Engine Programmer @ www.playspace.com - moritzwundke.com
            Remember: be polite and respect other peoples opinions - Join the Unofficial Unreal Discord Channel - Found a bug? Then use the Bug Report Form to get it fixed ^^

            Comment

            Working...
            X