Blueprint Variables

Properties that hold a value or reference an Object or Actor in the world.

Choose your operating system:

Windows

macOS

Linux

Variables are properties that hold a value or reference an Object or Actor in the world. These properties can be accessible internally to the Blueprint containing them, or they can be made accessible externally so that their values can be modified by designers working with instances of the Blueprint placed in a level.

Variables are displayed as rounded boxes that contain the name of the variable:

Variable Nodes

Variable Types

Variables can be created in a variety of different types, including data types - such as Boolean, integer, and float - as well as reference types for holding things like Objects, Actors, and particular Classes. Arrays of each variable type can also be created. Each type is color coded for easy identification:

Variable Type

Color

Example

Represents

Boolean

Maroon

RedWire.png

True or false value ( bool ).

Byte

Sherpa blue

get-byte-variable-icon.png

Whole number value bewtween 0 and 255 ( unsigned char ).

Integer

Sea green

CyanWire.png

Whole number value between −2,147,483,648 and 2,147,483,647 ( int ).

Integer64

Moss green

get-integer64-variable-icon.png

Whole number value between −9,223,372,036,854,775,808 and 9,223,372,036,854,775,807 ( long ).

Float

Yellow green

GreenWire.png

Number value with a decimal such as 0.0553, 101.2887, and -78.322 ( float ).

Name

Mauve

get-name-variable-icon.png

Piece of text used to identify something in the game.

String

Magenta

MagentaWire.png

Group of alphanumeric characters such as Hello World ( string ).

Text

Pink

PinkWire.png

Text that you display to users. Use this type for text that you want to localize.

Vector

Gold

GoldWire.png

Set of three numbers (X, Y, and Z). This type is useful for 3D coordinates and RGB color data.

Rotator

Cornflower blue

PurpleWire.png

Group of numbers that define rotation in 3D space.

Transform

Orange

OrangeWire.png

Set of data that combines translation (3D position), rotation, and scale.

Object

Blue

BlueWire.png

Blueprint objects such as Lights, Actors, StaticMeshes, Cameras, and SoundCues.

Variables in the My Blueprint Tab

The My Blueprint tab allows custom variables to be added to the Blueprint and lists any existing variables, including component instance variables added in the Components List or variables created by promoting a value to a variable in the graph.

My BLueprint Pane

Creating Variables

Creating a variable inside a Blueprint can be achieved by following the steps below.

  1. Create a Blueprint and open it up to the Graph tab.

  2. Create a new variable from the MyBlueprint window, by clicking on the Add Button plus_Button.png on the variable list header myblueprint_variable.png .

    MyBlueprintPane_createVar.png

  3. A new variable will be created, prompting you to enter a name for it.

    HT5.png

    Enter a name for your variable, then proceed to the Details panel to adjust the properties of the variable.

  4. In the Details panel, there are several settings that can be used to define how your variable is used or accessed.

    HT6.png

    In order to set the Default Value for a variable, you must first Compile the Blueprint.

Option

Description

Variable Name

The name of the variable.

Variable Type

Set the Variable Type via the dropdown menu and determine if the variable is an Array or not.

Instance Editable

Whether the variable is publically editable on instances of the Blueprint.

Blueprint Read Only

Whether this variable can be set by Blueprint nodes or if it is read-only.

Tooltip

Extra information about this variable, shown when the cursor is over the variable.

Show 3D Widget

When true, allows the user to tweak the vector variable by using a 3D transform widget in the viewport. This option appplies to the Vector and Transform types, and it is enabled only when Instance Editable is selected.

Expose on Spawn

Should the variable be exposed as a pin when spawning the Blueprint.

Private

Should the variable be private (derived Blueprints cannot modify it).

Expose to Cinematics

Should the variable be exposed for Sequencer or Matinee to modify it.

Config Variable

Allows the variable to be set from a config file.

Category

Allows you to categorize the variable by a label given. Variables will be sorted by their label.

Replication

Should this variable be Replicated over the network or not.

There are some serialization options that can be defined by expanding the Details panel as well.

HT37.png

Here you can set whether or not the variable is serialized and is zero-filled at load with the Transient option. You can also set whether or not the variable is serialized for saved games with the SaveGame option.

Public Variables

To allow a variable to be modified from outside its Blueprint, make it public.

HT21.png

By default the eye is closed (private); select the eye to open it and make it public. You can also select or clear the Instance Editable box to make the variable private or public.

After you've made the variable public, you can modify its value from the Details panel of the Main Editor window.

HT23.png

Above, the variable LightColor has been set to Editable and we can now set this value in the Details panel of the Level Editor.

Variable Tooltips

You can also add a Tooltip for your variables that will appear when mousing over the variable in the editor.

HT25.png

You can add the Tooltip from the Details panel of the variable. When doing so, if the variable is set to Public , the Eye Icon will change from yellow to green indicating that a Tooltip has been written for the variable.

HT24.png

Expose on Spawn

Expose on Spawn enables you to set if the variable should be accessible at the time of spawning the Blueprint it sits in.

HT26.png

Above we have a variable called LightColor which is a Linear Color property that is set to Expose on Spawn . This variable is implemented in a Blueprint for a Point Light that uses the Set Light Color node and the LightColor variable to determine the color the light should be.

Below, inside a different Blueprint, a script is used to spawn the Point Light Blueprint and since the LightColor variable was set to Expose on Spawn, the option to set the value is made available on the Spawn Actor from Class node, allowing us to set its color when the light spawns in the game world.

HT27.png

Private Variables

With the Private option checked on a variable, this prevents the variable from being modified from external Blueprints.

For example, we have a variable below that is not set to private:

HT42.png

Inside another Blueprint, we spawn the Blueprint that contains the variable, then off the Return Value we can access our variable.

HT43.png

If we were to set it Private however:

HT41.png

And spawn the Blueprint again and try to access that variable, we cannot.

HT44.png

Expose to Cinematics

If you want the value of your variable to be affected by Sequencer or Matinee , select Expose to Cinematics .

To learn more about the sequencer, see Sequencer Editor .

As of 4.23, Matinee is no longer supported by UE4 and will be removed from the engine in the near future. Once removed, you will no longer be able to run a Matinee or open Matinee Editor .
Please use the Matinee to Sequencer Conversion Tool to convert any files to Sequencer as soon as possible.

Promoting to Variable

You can also create variables by using Promote to Variable .

Right-click any input or output data pins on a Blueprint node and select Promote to Variable .

HT38.png

By right-clicking the New Light Color pin and selecting Promote to Variable , we can assign a variable as the New Light Color value.

HT40.png

Alternatively, you can drag off an input or output pin and select Promote to Variable .

HT39.png

Accessing Variables in Blueprints

When working with variables in Blueprints, you will access them in one of two ways: by using the Get node (referred to as a Getter) to get the value of the variable or by using the Set node (referred to as a Setter) to set the value of the variable.

HT45.png

You can create a Set node (1 above) or Get node (2 above) for a variable by right-clicking in the graph and typing either Set (variable name) or Get (variable name) . Another method you can use is to hold down the Ctrl key and drag in the variable from the MyBlueprint window to create a Get node or hold down the Alt key and drag in the variable from MyBlueprint window to create a Set node.

Editing Variables

Variable values can be set either as a part of the Blueprint node network or as a default value prior to execution. To set variable default values:

  1. Click Class Defaults on the Blueprint Editor Tool bar to open the Defaults in the Details panel.

  2. In the Details panel, enter the desired default values to the right of your variable name.

    blueprint_details_variable_callout.png

    Above, we highlight our Color variable in which we can set its default color.

If you do not see your variable listed in the defaults, make sure to click Compile .

Renaming Variables

To rename a variable:

  1. Right-click the variable name in the My Blueprint tab and select Rename in the menu that appears.

    rename_variable_menu.png

  2. Type the new variable name in the text box and then press Enter .

    rename_variable.png

Variable Properties

You can set all the properties for a variable in the Details panel. Some variables may have more properties than those shown here, such as Expose to Cinematics for Vectors or a Slider Range for numeric variables like Integers or Floats.

Property

Description

Variable Type

Set the variable type in the dropdown menu and determine whether or not the variable is an array.

Instance Editable

Set whether or not it is possible to edit the value of the variable in the Class Defaults and the Blueprint's Details tab.

Tooltip

Set the tooltip for the variable.

Private

Set whether or not this variable should be private and not modified by derived Blueprints.

Category

Choose from an existing category or type a new Category name. Setting the Category determines where the variable appears in the Class Defaults , the My Blueprint tab, and the Blueprint's Details tab.

Replication

Choose if the variable's value should or should not be replicated across clients, and if the value is replicated, if there should be a notification by way of a callback function.

Advanced Variable Properties

Property

Description

Config Variable

Read its default value from a config file if it is present? Use this option to customize variable default values and behavior between different projects and configurations.

Transient

Not serialize and be zero-filled at load.

SaveGame

Be serialized for saved games.

Advanced Display

Be hidden in Class Defaults windows by default.

Multi line

Be capable of displaying multiple lines. To add a new line while editing the variable, press Shift+Enter.
Note: This option applies only to String and Text variables.

Deprecated
Deprecation Message

Be deprecated. Any nodes that reference the variable will produce a compiler warning indicating that it should be removed or replaced.
(Optional) You can specify a message to include with the warning. For example: X is no longer supported. Please use Y instead.

Getting & Setting Variable Values

Variables can also be edited as a part of your Blueprint network by way of Get and Set nodes. The easiest way to create these is by dragging a variable from the Variables tab directly into the Event Graph. A small menu will appear asking if you would like to create a Get or Set node.

VariableGetSet.png

Get Nodes

Get nodes supply portions of the network with a variable value. Once created, these nodes can be plugged into any node that takes the appropriate type.

GetVariable.png

Set Nodes

Set nodes enable you to change the value of a variable. Note that these must be called by an execution wire in order to execute.

SetVariable.png

Shortcuts when dragging from the My Blueprint tab

Ctrl-drag

Creates a Get node.

Alt-drag

Creates a Set node.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss