Skip to content

Testing Your Script

Once you've imported a script into Unreal, you probably want to test it. It can be handy to iterate with the writing / testing process a number of times, not just to make sure you haven't made a mistake, but also because sometimes you only get a true idea of how the dialogue flows once you actually start to test it.

Double-click on the MyFirstScript asset (not the "Strings") version to open the script asset window, which shows you the editor runner:

Editor Runner

Starting the Dialogue

The toolbar is where you can find the "Start Dialogue" button. This (re)starts the dialogue from the label shown in the drop-down box to the right of it.

This defaults to starting the dialogue from the beginning, but you can start from any label defined in the script. This can be handy if you use combined scripts for lots of smaller interactions and just start the dialogue from the appropriate section, rather than having lots of separate scripts.

Output & Choices

Once the dialogue is running, you'll see speaker lines displayed in the Dialogue Output tab. Buttons will appear at the bottom of this tab for you to make choices, or simply continue the dialogue.

For now, just click the Start Dialogue button in the toolbar and use the choice buttons underneath the dialogue window to run through the dialogue. Do you see how it relates to the text script?

Next Steps

So, that's how you can quickly test your dialogue without actually having to hook anything up in your game (or even if you do hook it up, having to play to the correct place in the game to see the dialogue).

Next, let's talk about how to actually run the dialogue inside the game.

Extra details about the Editor Runner

If you're curious about what else is in the editor runner dialogue, here's some more details.

Trace Log

The trace log at the bottom shows everything the dialogue output window does, plus additional information about which line is being executed, what changes are being made to variables, what events are being raised, and what conditional lines are evaluated, and what the outcome was.

The trace log is very useful for debugging what's happening in your dialogue.

Variable Tab

The variables tab shows the current variable state for the dialogue. It's editable, so you can change any variable values on the fly if you want, to simulate different scenarios. We haven't talked about variables yet, but it's worth knowing that you can see and edit them here.

Variables which are set in the script appear here automatically, but you can also manually add variables as well. This is usually variables which would be supplied by code while the game is running, but you can hack them in here for testing.

Any variables you add manually will have a slightly purple colour tint:

Variables Tab

Variables you manually add will not be cleared when you restart the dialogue, unlike the rest of dialogue state. This is so you can re-run the dialogue multiple times and not have to keep manually setting up the state every time.

Details Tab

This tab shows you a few details about the script, such as the speaker list. It's also where you can optionally edit any voice over sounds later, but that's outside the scope of this tutorial.