Blutilities w/ Example

What is a Blutility?

A blutility is a blueprint that runs in the editor that allows you to execute (certain) code. This is useful if you want to (for example) modify properties of placed actors in the world.

Enabling Blutilities in the editor

In order to make and work with blutilities, you will need to allow the editor to do so. In the Editor Preferences, you can do a simple search for “blutility” and you will see the “Editor Utility Blueprints (Blutility)” option show up. Check this box, and you can start making blutilities by creating a new actor, and as the base, picking the “GlobalEditorUtilityBase” as it’s parent.

Editing Blutilities

When you create a blutility, you will find that it’s in many ways identical to making a blueprint.

To see the power inherent in blutilities, feel free to open the CampBlutility or any of the other blutilities in the editor.

Blutility Example - Use blutility scripts to search all blueprints that have a given property

1. Create a blutility file

In this article we’ll use the example script located in exiles: \Content\Tools\Blutility_Example.uasset

Using it as a base for your script is the simple way to go, you can simply change it locally and run it. Otherwise, you can create a new script by right clicking in the content browser, and they select Blueprint->Blutility, and choose GlobalUtilityBase as the parent.

2. Opening the file

Double clicking on the file won’t actually allow you to edit it.

You need to right click, and then select “edit blueprint”

3. The file itself

Here is what the file \Content\Tools\Blutility_Example.uasset looks like:

CheckDefaultVariable

You can check whichever property you want, and run basically any blueprint logic you want, just like in a regular blueprint.

CheckComponentVariable

There is an issue in Unreal where the defaults that are set on a component of a base class are not accessible from the CDO of the class. So the script above would not work when checking something in the defaults of the AILOD component of BaseNPC, for instance.

In order to make that work, there is a specific function to use: FindDefaultComponentInClass:

You can either get the first component of a given class, or identify it by name. Names on the default should be unique

4. Running the file

You first need to compile and close any open tab in which you’re editing the script. Then, you can simply double click on it to open a window containing a button to run your function. You can simply click the button. Running the script the first time might take a while, because it needs to load all the classes. The subsequent runs should be much faster.

The results will appear in the output log.

5. Data checks

Similar to Data Table Testing , there is a collection of blutility checks on existing data that is available at Game/Dev/Blutility_SanityChecks . The checks can be used to make sure the game assets are properly set up and made to be extended!