# How to print debug output in C++ from OnConstruction()?

**URL:** <https://forums.unrealengine.com/t/how-to-print-debug-output-in-c-from-onconstruction/302471>\
**Category:** Debugging, Optimization, & Profiling\
**Tags:** debug, unreal-engine, construction-script, CPP, question\
**Created:** [December 26, 2014, 6:34am UTC](https://forums.unrealengine.com/t/how-to-print-debug-output-in-c-from-onconstruction/302471 "2014-12-26T06:34:29Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![eXi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/exi/32/906583_2.png) [@eXi](https://forums.unrealengine.com/u/eXi)\
**Post date:** [December 26, 2014, 1:10pm UTC](https://forums.unrealengine.com/t/how-to-print-debug-output-in-c-from-onconstruction/302471/2 "2014-12-26T13:10:58Z")

</div>

Hm, i just searched the API for GEngine. It is a pointer to the UEngine which is the base class of all Engine classes. UEngine got the AddOnScreenDebugMessage, so if GEngine is null, the pointer has no reference to the UEngine. The bad thing is, i couldn’t find any information about the chronological order of the initialization of this UEngine etc. so i can’t tell you if the Pointer is just null because it wasn’t set by now (so you could use something else than this pointer) or if the whole UEngine isn’t initialized at this point.

Have you tried checking if the OnConstruction() is called at all? You could try using a normal Log Debug etc.

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

EDIT: Would be nice to know where GEngine is set :X I can’t find that for now.

---

_[View the full topic](https://forums.unrealengine.com/t/how-to-print-debug-output-in-c-from-onconstruction/302471)._
