Getting the Widget Component to Always Face the Camera in UE5

When creating an actor that has a widget component attache it be helpful to sometimes have that widget always face the player's camera

Unreal Engine 5 Manny with a basic widget component above his head with a name and red progress bar

Software Versions: Unreal Engine 5.5.0 | Rider 2024.3

Project Name: MyProject

Getting a widget component to face the camera can be achieved simply by using the AlignMeshToTheCamera material node.

The default material for a widget component is Widget3DPassThrough_Masked_OneSided which is an instance of Widget3DPassThrough. So I copied over Widget3DPassThrough to content folder so I can edit it without consequence. The file path for the material is /Engine/EngineMaterials/Widget3DPassThrough.Widget3DPassThrough.

Unreal Engine 5 editor engine directory for Widget3DPassThrough material
Widget3DPassThrough material

I copied the material over to /Game/Materials/Widgets and renamed it to M_Widget3DPassThrough_Align. Open up the material to edit it. Add the AlighMeshToTheCamera node to the material and attach the World Position Offset pin to the material's World Position Offset value pin.

Unreal Engine 5 M_Widget3DPassThrough_Align material with AlignMeshToTheCamera node
M_Widget3DPassThrough_Align

To be consistent I created a material instance from M_Widget3DPassThrough_Align and called it M_Widget3DPassThrough_Align_Masked_OneSided and updated it match the engine version.

Unreal Engine 5 material instance align mesh one sided
M_Widget3DPassThrough_Align_Masked_OneSided

Create a new Blueprint and add a widget component to the actor. For testing I added a skeletal mesh a put a health bar component above the actor. In the widget component update the material to our newly created M_Widget3DPassThrough_Align_Masked_OneSided and then very importantly we must also change the widget's rotation to be absolute.

Unreal Engine 5 Blueprint viewport with updated widget component material and absolute rotation
Widget Component with absolute rotation and new M_Widget3DPassThrough_Align_Masked_OneSided material

Below is the final result.

Unreal Engine 5 Quinn running around Manny with a health bar widget component that always faces the camera
I'm dizzy...but the widget follows the camera

This example can be seen in the project's gym using the BP_MyStructPlayer Blueprint.

I hope this helps.

Loading...