Adding Automation Projects

How to add an automation project for AutomationTool.

Choose your operating system:

Windows

macOS

Linux

Prerequisite Topics

In order to understand and use the content on this page, make sure you are familiar with the following topics:

You can implement project-specific automation scripts that will be compiled and loaded by AutomationTool by creating a new C# project in a location that AutomationTool can find it.

This requires using a source build of the engine (from GitHub or Perforce, rather than from the Epic Games launcher), and for the project to be in a location discoverable from a subdirectory listed in the UE4Games.uprojectdirs file. This file is located in the UE4 root directory.

Steps

  1. In Visual Studio, right click your project folder, and select Add > New Project...

  2. With the Add New Project menu open, select the Class Library (.NET Framework) Visual C# option, and for illustrative purposes, use the following settings:

    Setting

    Value

    Note

    Name

    SampleScript.Automation

    The project's generation script looks for a *.csproj file with the *.Automation.csproj extension.

    Location

    [ProjectDir]\Build
    [EngineDir]\Source\Programs

    *.uproject file, which means that the game is under one of the directories listed in the UE4Games.uprojectdirs

    Framework

    4.6.2

    The .NET framework we are using as of the time of this writing.

    *.build.cs or a *.target.cs

  3. For illustrative purposes, right click SampleScript.Automation > Class1.cs , select Rename , and name it SampleScript.cs .

Updating the Project's Settings

Now that the solution has a new automation project, it is time to set its build configuration and the project's build output path.

Rename the Release Build Configuration

With the SampleScript automation project selected:

  1. Open Build > Configuration Manager...

  2. Find the SampleScript.Automation project in the list, and select Edit... from the Configuration column.

  3. From the Edit Project Configurations window, select the Release configuration, and press the Rename button.

    1. Set the new name to Development .

  4. Close both windows.

Set the Project Build Output Path

With the Build tab selected in the project's property menu:

  1. Select All Configurations.

  2. Now, set the Output path: field to your project's automation script directory.

    • You can either use Browse... or you can type in the output path

    • The output path is relative to your project's root directory, so make sure to navigate through parent directories using '..'

    • If you do not set the project's output path properly, AutomationTool will not discover your automation commands

  3. Close Visual Studio and run GenerateProjectFiles.bat .

  4. To verify the setup, open the generated UE4.sln , and navigate to UE4 > Programs > Automation in the Solution Explorer to locate the newly added Automation project.

Adding the Required Assembly Reference

To use base functionality provided by AutomationTool, you need to add a reference to the AutomationUtils library:

  1. Locate your project in the Solution Explorer under Programs > Automation .

  2. Under the project folder, right click on References and select Add Reference... .

  3. From the Reference Manager Projects menu, locate and select AutomationUtils.Automation before clicking OK .

End Result

Now that you have added an automation project with the appropriate settings and references, you are ready to learn how to add a command .

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss