triangular-flag_1f6a9.png

We have already learned many things in the previous chapters.

Setting up UE and a code editor, running python in UE and the Python basics.

Here, we’ll see how to create and run scripts, so that we can start automating some stuff!

Table of contents

Running a Python script

With the content integration option enabled (Edit > Editor Preferences > Plugin > Python), you should see Python assets in the Unreal Project provided with the project files of this training.

Right click on the asset place_cube in Content/Python/Help/Unreal and press Run . A new cube should appear in the level.

hello world.gif

Running a script from the tools menu

You can also run scripts from there.

Untitled

Running a script from the command line

And from the command line.

Untitled

When the scripts are under the Content/Python folder, you don’t have to specify the whole path.

Untitled

Creating a script

Simply right click somewhere in the Content Browser, under the Python folder and press Create Python Script. Then double click to open it