S1.16 Adding our first variable

Lesson Summary

In this lesson, we covered:

  • Events that you can find in the event graph.
  • Input events.
  • Variables.

What did we do?

✅ Updated for UE 5.4.1

Create the InputAction Event for the character movement

  • Open the Player Controller called PC_MyDungeonCrawler.
  • Make sure you are in the Event Graph of the blueprint.
  • Right-click on the empty graph, type MoveAction, and select the Action Event with the same name.

Create a variable to know when the player is holding down the move input key

  • In the left-side panel called My Blueprint, go to the Variables section and click on the button
  • Change the variable type to a Boolean if it isn't that value already.
  • Rename the variable to IsMoveActionEnabled by selecting it with the left click, and clicking on it again, or pressing the F2 key.
  • Compile by clicking the Compile button on the top-left side of the editor, or by pressing F7.
  • Set the variable value in the graph by dragging and dropping the variable to the graph and choosing the Set IsMoveActionEnabled or by dragging and dropping the variable while holding the Alt key.
  • Connect the nodes like in the video.

Code added in this video:

To copy the nodes in any graph, you can select them and press Ctrl + C or use the button below each graph. After copying the nodes, paste them (Ctrl + V) inside the editor's graph.

PC_MyDungeonCrawler

Hotkeys learned

In the Blueprint Editor

Rename a variable: while the variable is selected, press F2

Compile blueprint: F7

Get a variable in the graph: while dragging and dropping a variable into the graph, hold the Ctrl key.

Set a variable in the graph: while dragging and dropping a variable to the graph, hold the Alt key

Unreal Engine Terminology

Event Graph: This is the graph where most of the logic inside our blueprints will exist. Runs only when the game is running.

Events: Red-colored nodes that fire or run whenever they're told to. It is used to start the execution of logic connected to it.

Event BeginPlay: This event runs when you start the game. 

Event Tick: This event runs every tick. This usually means every frame, but not always.

Variables: A place where we can store information. When you create a variable, you need to define its name and type. Depending on the type, you will be able to perform certain operations with it.

Got Questions?

The UNF Games team is here for you! Members of our Private Community can ask questions about anything from this chapter by clicking on this link and creating a New Topic, where the Title starts with the Section and Video number.

Example title of new topic: [S3.12] Weird issue that I can’t solve

We know that nothing is perfect, so if the subtitles of this lesson are weird, or they don't make much sense, please let us know by making a post in this category in our community page.

Example title of new topic: [S3.12] Spanish - Weird translation issue that don’t make sense

If you have bought the course and haven't yet checked out our Private Teachable Community yet, just click on this link and see what you have been missing.

Ready to move on? Click "complete & continue" to proceed to the next lesson.

Complete and Continue