Adding Automation Projects

How to add an automation project for AutomationTool.

Windows
MacOS
Linux
Prerequisite Topics

This page assumes you have prior knowledge of the following topics. Please read them before proceeding.

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

    You can save the project in a Build or Source directory.

    For Build directories, it needs to be within a directory alongside a discoverable *.uproject file, which means that the game is under one of the directories listed in the UE4Games.uprojectdirs file.

    Framework

    4.6.2

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

    The project cannot be in a folder with a *.build.cs or a *.target.cs file.

  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.

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