1. Set Up Module Dependencies for UMG

Modifying our project to include the modules needed to build menus.

On this page

If you are new to Unreal Engine 4, you might want to read our Programming Quick Start tutorial first. For this tutorial, we will assume you are familiar with creating a project, adding C++ code to it, and compiling your code. We will also expose functions and properties to Blueprint. If you would like to learn more about that, the Variables, Timers, and Events tutorial is a good place to start.

  1. We will begin by creating a new project: Select the C++ tab. Select Basic Code. Leave the default values of Desktop/Console and With Starter Content. We will use the name HowTo_UMG.


    Since we're going to write code that uses Unreal Motion Graphics (UMG), we'll need to go into Visual Studio include a few modules that aren't available by default.

  2. We can get to our project's code by using the Open Visual Studio command from the File dropdown menu on the main editor screen.


  3. UMG is dependent on a few modules, so we'll need to add those modules to HowTo_UMG.Build.cs.


    In HowTo_UMG.Build.CS, we need to add UMG to the list of included public modules, and Slate and SlateCore to the list of included private modules. We'll need to modify the first line in HowTo_UMG's constructor to read as follows:

    PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG" });

    And then we can uncomment the following line:

    PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });

    As usual, full source code is provided below so you can double-check your code.

With UMG set up, we can add code to our project's custom Game Mode to create and display our game's menus.

Work-In-Progress Code


// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;

public class HowTo_UMG : ModuleRules
    public HowTo_UMG(TargetInfo Target)
        PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG" });

        //PrivateDependencyModuleNames.AddRange(new string[] {  });

        // Uncomment if you are using Slate UI
        PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });

        // Uncomment if you are using online features
        // PrivateDependencyModuleNames.Add("OnlineSubsystem");
        // if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64))
        // {
        //      if (UEBuildConfiguration.bCompileSteamOSS == true)
        //      {
        //          DynamicallyLoadedModuleNames.Add("OnlineSubsystemSteam");
        //      }
        // }
Select Skin

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback