skip to Main Content

Creating console commands

In this post we’re going to create our own custom console commands. Unreal Engine 4 provides a specifier named Exec, for the UFUNCTION macro which declares that the following function can be executed through the console window of the engine (to open up the console window press the ~ key in your keyboard). However, there is a catch – currently only specific classes execute the said functions. According to UE4 answershub, these classes are:

  1. Pawn
  2. PlayerController
  3. CheatManager
  4. GameMode
  5. PlayerInput and
  6. HUD

Creating console commands

For this post, I’ve created a blank C++ project. Then, I opened up the header file of my game mode and added the following functions:

Here is their implementation:

Save and compile your code, then in the default map in the World Settings make sure to specify your c++ (or the derived BP) game mode in the game mode override option:


Then, when you press play if you open up your console you can execute the functions we’ve created above by typing their name and pressing enter.

In order to pass multiple parameters in the console window, type the name of your function and space your pamateres like so:

DoubleParamFunction 123.4323 5000

Here is my output after calling each function:


Avatar photo

This Post Has 0 Comments

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