Blueprint Variables
Blueprint Variables are properties that hold a value or reference an Object or an Actor in the world.
Variables are displayed as rounded Nodes containing the name of the variable and having a color coded out pin representing what type of data the variable holds.
- Boolean [Maroon]: True or false value (bool).
- Byte [Sherpa Blue]: Whole number value between 0 and 255 (unsigned char).
- Integer [Sea Green]: Whole number value between −2,147,483,648 and 2,147,483,647 (int).
- Integer64 [Moss Green]: Whole number value between −9,223,372,036,854,775,808 and 9,223,372,036,854,775,807 (long).
- Float [Yellow Green] Number value with a decimal such as 0.0553, 101.2887, and -78.322 (float).
- Name [Mauve]: Piece of text used to identify something in the game.
- String [Magenta]: Group of alphanumeric characters such as Hello World (string).
- Text [Pink]: Text that you display to users. Use this type for text that you want to localize.
- Vector [Gold]: Set of three numbers (X, Y, and Z). This type is useful for 3D coordinates and RGB color data.
- Rotator [Cornflower Blue]: Group of numbers that define rotation in 3D space.
- Transform [Orange]: Set of data that combines translation (3D position), rotation, and scale.
- Object Types [Blue]: Blueprint objects such as Lights, Actors, StaticMeshes, Cameras, and SoundCues.
- Structure [Dark Blue?]: A struct is a collection of different types of data that are related and held together for easy access. Unreal Engine 4.27 Documentation - Struct Variables in Blueprints
- Interface [Yellow?]: A Blueprint Interface is a collection of one or more functions - name only, no implementation - that can be added to other Blueprints. Unreal Engine 4.27 Documentation - Blueprint Interface
- Enum [Dark Green?]: A selection list of named integers.
The My Blueprint panel is where you can create your custom variables. If the My Blueprint panel is not visible in your blueprint, go the top and select the Window Menu, then select My Blueprint and you should see it on the left hand side. Go down to VARIABLES and select the plus sign to add a new variable. The first part of the new variable is where you can type it's name. The second part is a drop-down list of what type of data you want your variable to be. The third part is an "eye" icon that you can toggle to make that variable public for other instances of current blueprint to edit it... or not public so other instances of the current blueprint can not edit it.
In the Details panel, there are several settings that can be used to define how your variable is used or accessed. If the Details is not visible, go to the top and select the Window Menu, then select Details and you should it on the right hand side. (NOTE: In order to set the Default Value for a variable, you must first Compile the Blueprint.)
You can set the variable Private in the Details panel. This will prevent the variable from being modified from other external Blueprints.
GET/SET Variable Nodes
When simply dragging your new custom variable to the Event Graph canvas, a small pop-up menu will display letting you pick to Get the value from the variable or Set the value of the variable. You can hold the Ctrl key and drag the variable to the Event Graph canvas to create a Get node directly. Also, you can hold the Alt key and drag the variable to the Event Graph canvas to create a Set node directly.
