# How do I detect the game if running in editor?

**URL:** <https://forums.unrealengine.com/t/how-do-i-detect-the-game-if-running-in-editor/374695>\
**Category:** C++\
**Tags:** unreal-engine, crash, bug-report, editor, UE4, question, CPP\
**Created:** [October 28, 2016, 3:08am UTC](https://forums.unrealengine.com/t/how-do-i-detect-the-game-if-running-in-editor/374695 "2016-10-28T03:08:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_ca716e4c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ca716e4c](https://forums.unrealengine.com/u/anonymous_user_ca716e4c)\
**Post date:** [October 28, 2016, 3:08am UTC](https://forums.unrealengine.com/t/how-do-i-detect-the-game-if-running-in-editor/374695/1 "2016-10-28T03:08:12Z")

</div>

Hello there, I’d like to print a run time message for lvl designers but I cannot find how to determine the game is running in editor. I tried the following code but it doesn’t work.

#if PlayMode\_InEditorFloating  
GEngine-\>AddOnScreenDebugMessage((-1, 5.0f, FColor::Red, TEXT(“destruction stage cannot be 0!”));  
#endif

Any ideas?
