Choose your operating system:
Windows
macOS
Linux
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
-
In Visual Studio, right click your project folder, and select Add > New Project...
-
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 theUE4Games.uprojectdirs
Framework
4.6.2
The .NET framework we are using as of the time of this writing.
*.build.cs
or a*.target.cs
-
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:
-
Open Build > Configuration Manager...
-
Find the SampleScript.Automation project in the list, and select Edit... from the Configuration column.
-
From the Edit Project Configurations window, select the Release configuration, and press the Rename button.
-
Set the new name to
Development
.
-
-
Close both windows.
Set the Project Build Output Path
With the Build tab selected in the project's property menu:
-
Select All Configurations.
-
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
-
-
Close Visual Studio and run
GenerateProjectFiles.bat
. -
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:
-
Locate your project in the Solution Explorer under Programs > Automation .
-
Under the project folder, right click on References and select Add Reference... .
-
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 .