x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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.

Product Version: Not Selected
Tags:
more ▼

asked Aug 11 '14 at 12:43 AM in C++ Programming

avatar image

nonder
136 13 22 33

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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

 #if UE_BUILD_DEBUG
 
 GEngine->AddOnScreenDebugMessage();
 
 #endif

Will build that code only on debug config build, or

 #if !UE_BUILD_SHIPPING
 
 GEngine->AddOnScreenDebugMessage();
 
 #endif

Will compile this code on everything other then shipping build config

more ▼

answered Aug 11 '14 at 02:50 AM

avatar image

Shadowriver
36.6k 931 169 1111

avatar image nonder Aug 11 '14 at 09:40 AM

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

avatar image WCode Aug 11 '14 at 11:49 AM

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

avatar image Shadowriver Aug 11 '14 at 12:31 PM

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

https://github.com/EpicGames/UnrealEngine/blob/6c0afee5903072d1c20863d86f8decfffaab71f1/Engine/Source/Runtime/Core/Public/Misc/Build.h

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question