Free Ebook cover Unreal Engine 5 for Absolute Beginners: Your First Playable Level

Unreal Engine 5 for Absolute Beginners: Your First Playable Level

New course

9 pages

Blueprints Fundamentals for Simple Interactive Gameplay in Unreal Engine 5

Capítulo 7

Estimated reading time: 9 minutes

+ Exercise

What Blueprints Are (and Why Beginners Love Them)

Blueprints are Unreal Engine’s visual scripting system. Instead of writing code, you connect nodes that represent logic (events, actions, math, checks) to create gameplay. Blueprints are not “less powerful” than code for beginner projects—they are a practical way to build interactive behavior quickly and clearly.

Key Blueprint Concepts You’ll Use Constantly

  • Events: Entry points that start logic when something happens (for example, Event BeginPlay, OnComponentBeginOverlap, input events).
  • Execution flow: White wires that define the order nodes run. Data wires (colored) carry values.
  • Variables: Named storage for values (like a door’s open angle, speed, or whether it’s currently open). Variables have types (Boolean, Float, Vector, Object Reference, etc.).
  • Functions: Reusable logic blocks you can call from multiple places. Functions are great for “OpenDoor” / “CloseDoor” behaviors.
  • References: A way to point to another object (a specific door mesh component, a light actor in the level, the player, etc.). Many beginner bugs come from missing/invalid references.

Goal: Build a Button That Opens a Door

You will create one Blueprint Actor that contains a button mesh, a door mesh, and a trigger volume. When the player overlaps the trigger, the button “activates” and the door rotates open smoothly using a Timeline. You’ll also expose variables so you can tweak open angle and speed without editing the graph.

Step 1 — Create a Blueprint Actor

  1. In the Content Browser, create a new Blueprint Class: Actor.

  2. Name it BP_ButtonDoor.

  3. Double-click to open it in the Blueprint Editor.

    Continue in our app.

    You can listen to the audiobook with the screen off, receive a free certificate for this course, and also have access to 5,000 other free online courses.

    Or continue reading below...
    Download App

    Download the app

Understand the Blueprint Editor Panels (quick orientation)

  • Components: The physical parts of your Actor (meshes, collision, audio, etc.).
  • Viewport: Arrange components visually.
  • Event Graph: Where gameplay logic is connected with nodes.
  • Details: Configure selected component or variable settings.

Step 2 — Add Components (Door, Button, Trigger)

Add a root and meshes

  1. In Components, click AddScene Component. Name it Root, then drag it to become the DefaultSceneRoot (or replace it).

  2. Add a Static Mesh component named DoorMesh.

  3. Add a Static Mesh component named ButtonMesh.

Assign meshes and position them

  1. Select DoorMesh and assign a door-like mesh (any simple cube works for learning). Position it where a door would be.

  2. Select ButtonMesh and assign a small mesh (a cube/cylinder). Place it near the door.

Add a trigger volume

  1. Add a Box Collision component named TriggerBox.

  2. Scale the box so the player can step into it near the button.

  3. With TriggerBox selected, ensure collision is set to generate overlap events. In the Details panel, confirm Generate Overlap Events is enabled.

Set up door pivot (important for rotation)

For a door that swings, the pivot should be at the hinge side. If your mesh pivot is centered, you can fake a hinge by adding a Scene Component as a hinge pivot:

  1. Add a Scene Component named DoorHinge.

  2. Make DoorMesh a child of DoorHinge (drag it under DoorHinge).

  3. Move DoorHinge to the hinge location (edge of the door). Keep DoorMesh positioned relative to it.

Later, you’ll rotate DoorHinge instead of the mesh itself.

Step 3 — Create Variables for Easy Tweaking

In BP_ButtonDoor, create these variables (My Blueprint panel → + Variable):

Variable NameTypeSuggested DefaultPurpose
OpenAngleFloat90.0How far the door opens (degrees yaw).
OpenTimeFloat1.0How long the open animation takes.
bIsOpenBooleanfalseTracks door state to prevent repeated triggers.
DoorClosedYawFloat0.0Stores the starting yaw at runtime.

Make OpenAngle and OpenTime easy to edit per instance:

  • Select each variable → in Details, enable Instance Editable.
  • Optionally enable Expose on Spawn if you plan to spawn this actor dynamically later.

Step 4 — Set Up Overlap Events (Trigger Starts the Interaction)

Create the overlap event

  1. Select TriggerBox in Components.

  2. In the Details panel, scroll to Events and click + next to OnComponentBeginOverlap.

This creates an event node in the Event Graph that fires when something overlaps the trigger.

Filter to only react to the player

Beginner-friendly approach: check that the overlapping actor is the player character.

  1. From Other Actor pin, add a node: Cast To your player character class (for example, BP_ThirdPersonCharacter if you’re using the template character).

  2. Use the Cast Succeeded execution pin to continue logic.

If you don’t know your character class, you can also compare to Get Player Character:

  • Use Get Player Character → compare with Other Actor using == (Object). Continue only if true.

Prevent re-triggering when already open

  1. Add a Branch node.

  2. Condition: NOT bIsOpen (use a NOT Boolean node).

  3. Only if true, start the door opening.

Step 5 — Animate the Door with a Timeline

A Timeline outputs a value over time (like 0 → 1). You can use that value to smoothly rotate the door.

Create the Timeline

  1. In the Event Graph, right-click and add Timeline. Name it TL_OpenDoor.

  2. Double-click the Timeline node to edit it.

  3. Add a Float Track named Alpha.

  4. Create two keys: at time 0.0 value 0.0, and at time OpenTime value 1.0.

  5. Set interpolation to Auto for smooth movement (or Linear for mechanical movement).

Important: if you want OpenTime to control the Timeline length, you have two common options:

  • Option A (simple): Keep Timeline length fixed (like 1 second) and control speed by scaling play rate using Set Play Rate.
  • Option B (direct): Set the last key time to match OpenTime and keep it consistent manually when you tweak.

Option A is more flexible for instance editing, so you’ll implement it below.

Store the closed rotation at runtime

Before opening, capture the starting yaw so the Blueprint works even if you rotate the actor in the level.

  1. Use Event BeginPlay.

  2. Get the current rotation of DoorHinge (or DoorMesh if you didn’t create a hinge): GetRelativeRotation.

  3. Break the rotator and store the Yaw into DoorClosedYaw.

Drive rotation from the Timeline

Back in the Event Graph:

  1. From the overlap logic (after the Branch), call Set Play Rate on TL_OpenDoor:

    • Play Rate = 1.0 / OpenTime (use a Float division node). If OpenTime could be 0, clamp it to a minimum like 0.05 to avoid division by zero.
  2. Then call Play on the Timeline.

  3. Select the Timeline node and use its Update pin to set the door rotation every frame of the animation.

On Update:

  1. Use the Timeline’s Alpha output.

  2. Compute target yaw: DoorClosedYaw + OpenAngle.

  3. Use Lerp (Float):

    • A = DoorClosedYaw
    • B = DoorClosedYaw + OpenAngle
    • Alpha = Timeline Alpha
  4. Make a Rotator with that yaw (Pitch 0, Roll 0, Yaw = lerped value).

  5. Apply it using SetRelativeRotation on DoorHinge.

Mark the door as open

  1. From the Timeline’s Finished pin, set bIsOpen to true.

If you want the door to close when the player leaves, you can also add OnComponentEndOverlap and use Reverse on the Timeline, setting bIsOpen false when finished reversing. For a first interactive element, opening-only is enough.

Optional: Add Button Feedback (Small Motion)

To make the interaction feel responsive, you can animate the button down slightly when activated.

  • Add a second Timeline TL_ButtonPress that moves ButtonMesh down a few units on Z using SetRelativeLocation.
  • Trigger it at the same time you play TL_OpenDoor.

References: When to Use Them and Common Pitfalls

In this chapter, your door and trigger are components inside the same Blueprint, so you can directly drag them into the graph as references (for example, drag DoorHinge into the graph and choose Get).

When you need to control something outside the Blueprint (like a separate Light actor placed in the level), you typically:

  • Create a variable of type Actor Reference (or a more specific type like Point Light reference).
  • Mark it Instance Editable.
  • In the level, select the Blueprint instance and assign the target actor in the Details panel.

If the reference is not assigned, Blueprint nodes that use it may do nothing or throw “Accessed None” errors.

Debugging Your Blueprint (Fix Problems Fast)

Use Print String to verify events and values

Print String is the fastest way to confirm that an event fires and that your variables contain what you think they do.

  • Right after OnComponentBeginOverlap, add Print String with text like: Overlap Triggered.
  • After the player check (cast success), print: Player Detected.
  • Before playing the Timeline, print OpenTime and OpenAngle by converting floats to string (use Append or ToString (float)).

Tip: Set Duration to 2–5 seconds while debugging so you can read messages clearly.

Use Blueprint Breakpoints and Step Through Execution

  1. Right-click an execution node (for example, the Play pin path) and choose Add Breakpoint.

  2. Play in Editor.

  3. Trigger the overlap. The game will pause when it hits the breakpoint.

  4. Hover over wires and pins to inspect live values (like Other Actor, bIsOpen, Alpha).

  5. Use the Blueprint debugger controls to step forward and see where execution stops.

Common mistakes and what to check

SymptomLikely CauseFix
Nothing happens when stepping into triggerOverlap not firingCheck Generate Overlap Events on TriggerBox; verify collision responses allow overlap with Pawn; add Print String directly on the overlap event.
Print says overlap triggered, but door doesn’t moveTimeline not playing or rotation applied to wrong componentEnsure Play is called; confirm Update is connected; apply SetRelativeRotation to DoorHinge (or correct component).
Door rotates strangely or around the centerPivot/hinge setup incorrectUse a DoorHinge Scene Component at the hinge edge; rotate the hinge, not the mesh.
Door opens instantlyTimeline length/play rate mismatchIf using play rate, confirm Set Play Rate is executed before Play; ensure OpenTime is not extremely small.
Door opens multiple times or spams logicNo state checkUse bIsOpen with a Branch to prevent re-triggering; optionally disable collision on the trigger after opening.
Blueprint runtime error “Accessed None”Invalid referenceIf referencing external actors, ensure the variable is assigned in the level; add IsValid checks before using the reference.

Quality-of-life: Add an IsValid guard for external references

If you later extend this Blueprint to control a separate actor (like a light), wrap the reference use:

IsValid (TargetActor) → Branch → (True) do the action

This prevents errors and makes debugging clearer.

Now answer the exercise about the content:

In a Blueprint door-opening setup using a Timeline, what is a recommended way to make the door open speed adjustable per instance using the OpenTime variable?

You are right! Congratulations, now go to the next page

You missed! Try again.

To let OpenTime control speed per instance, keep the Timeline at a fixed length and call Set Play Rate using 1.0 / OpenTime before playing it. This scales the Timeline playback without editing keys.

Next chapter

Creating a Clear Objective: Collectible Item and Win Trigger

Arrow Right Icon
Download the app to earn free Certification and listen to the courses in the background, even with the screen off.