skip to Main Content

BeginPlay and GLog Explanation

While developing, you should have a way to output messages so you can check what’s happening in your game. Unreal Engine provides different ways to do that, so you can choose what is best for your needs. In this tutorial you are going to see the GLog function.

Enabling the Output Log in UE Editor

The message that I’m going to display will not appear on Viewport. Instead, it’s going to appear in the output log. To display the Output Log into the Editor:

  1. Go to your UE4 Editor
  2. Click on the Window on the top left corner
  3. Select Developer Tools
  4. Select Output Log

The default position of the Output Log is docked next to your Content Browser as the following image shows:


Logging a message in the BeginPlay function

The BeginPlay function of an Actor, is executed when one of the following conditions is true:

  • When the game starts, if the Actor is already placed in the level and we press the Play button.
  • When the Actor is spawned into the active level.

For this case, I created an Actor named LogActor and typed in the following code inside the BeginPlay function:


In order to test if BeginPlay and GLog actually work:

  1. Compile your project
  2. Create a Blueprint which inherits the LogActor class
  3. Place the above Blueprint somewhere in the test level
  4. Click Play
  5. Check your Output Log

If you followed all the steps your output should contain the “Hello from C++” message as seen in the image below:


Avatar photo

This Post Has 2 Comments

  1. Hi, thank you for your incredible lessons, they’re awesome, really well explained and designed, easy to comprehend, like putting a step forward at a time.

    I just had a simple question:
    What’s the main difference between
    ‘GLog->Log(“Some string”);’
    ‘UE_LOG(LogClass, Log, TEXT(“Some other string”));’

    I mean, GLog is a macro which is getting() the instance of the FOutputDeviceRedirector class which has log() functions from his parent that I found there:

    But UE_LOG() is a macro using FMsg struct which contains log and messaging functions but allow me to make a more complex logging system with “categories” (,_Printing_Messages_To_Yourself_During_Runtime ).

    How does it differ technically speaking ? Which one should I use for what purpose ?

    Thanks again for all your amazing work. =D

    1. First of all, thank you for your feeback!

      I like to use UE_LOG for warnings and errors since it provides a more “visual” feedback to the user (because of the yellow and red colors of warnings and errors respectively). I use GLog when I’m debugging my own code or when I want to stay informed about something which is not crucial. To be honest I’m not aware of their technical differences.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back To Top