Create an Interface Using Blueprints in Unreal Engine 5

Creating an interface can be fun and simple in UE5 and definitely be valuable tool while programming game logic

Unreal Engine 5 Quinn mannequin standing in front of moving platform demo level next to the lever
Quinn in front of the platforms

Software Version: Unreal Engine 5.4.4

Interfaces are a great way to listen for events happening in the game world without having to cast to an actor or be referenced directly. In this brief example I make very small interface that platforms inherent and move to the position when called.

Start by creating a Blueprint interface. I created one and gave it a generic name, I_Cycles.

Unreal Engine 5 creating a new interface
Create an BP interface

Next I added an empty function to the interface called MovePlatforms. Each platform will then listen for this event.

Unreal Engine 5 interface with Move Platform function
MovePlatform function inside I_Cycles

Then I created a Blueprint Actor that simply has a cube component. You have to add the interface to the Blueprint under Class Settings so it listen for events. When the MovePlatform function is called, the mesh component slides to it's actor's root position of FVector(0.0, 0.0, 0.0). I also added a timeline to smoothly transition location during the lerp phase.

Unreal Engine 5 BP Moving Platform with class settings and interface highlighted
BP_Moving_Platform

After that, I made a simple Lever Blueprint with a Box Collision that OnComponentBeginOverlap will call the MovePlatform function for each actor inside its Platforms array variable.

Unreal Engine 5 Lever Blueprint for BP Interface demo
BP_Lever_Trigger

When we're all done making the Blueprints we then put them into action. I put the lever on top of ramp and then dragged in 4 BP_Moving_Platforms, adjusted their mesh component accordingly, and then added the platforms to the lever's Platforms array.

Unreal Engine 5 Blueprint Interface playground with lever highlighted with platform variables
Blueprints placed in the level along with the trigger

When the trigger is activated the platforms will come together and to form a bridge for the player. A small piece of gold is waiting for the player at the end.

Unreal Engine 5 moving platform interface in action
Activating the platforms

Quick, simple, and super helpful.

Loading...