How to show widget component on screen space

I tried to change the space of my widget component to screen:

image

But when I play in editor, nothing is showed on my screen.

How can I get it to display?

It’s not enough to create a widget. You also need to instantiate your widget and add it to a viewport or else unreal does not know if it schould be displayed.

as an example you could add something like this to your level blueprint.

2 Likes

I searched on the Internet and people seem to be able to do that by using widget component:

Widget component on screen space - how to scale? - Development Discussion / Blueprint Visual Scripting - Unreal Engine Forums

Screen Space Widget Component Disappears? - UE4 AnswerHub (unrealengine.com)

I just don’t know how.

What Atcen said is correct. You have created a widget in the editor but have not spawned it at runtime. You have to spawn the widget using create widget node(usually done on player controller) and then add it to the viewport so the player can see it.

2 Likes

Thanks, I think this is the way:

This is the widget:

image

3 Likes

Don’t add the widget to the Viewport if you create it from a Widget component. Doing that, you’re just adding the overhead of having the component (like Ticking it, updating its transform, computing its occlusion, etc), but it’s wasted performance since you’re using the widget as a standard 2D widget, which has its own Ticking and none of the rest.

If you want it fixed on the screen like that, do what @Atcen said, creating it directly, and don’t use the widget component at all.

The widget component is for when you need the widget to follow a location in the 3D world and be displayed as:

  • a 3D plane (optionally curved) in the world or
  • a 2D plane, like standard widgets, but following its 3D location in the world, moving around the screen with a fixed size and disappearing from view when you look away from it.

For the 2D case, it’s only visible when you play the game (including Play in Editor). It’s not visible in edit mode (not playing) nor Simulate mode.

Thank you. I don’t think I have that issue in UE5 anymore.

1 Like

Cool :slight_smile:
I’ve just had the issue with Screen mode hiding it. I was using Simulate mode to test some features, which wouldn’t display the widget, so I got here looking for a solution.

But I saw the idea of adding the component to the screen manually and that shouldn’t be done, so I’m just trying to leave the most complete information possible here for future devs (and myself haha)

2 Likes

You should be able to add a widget component wothout using “create widget” or “add to viewport”. I just watched a video on it.

Problem is he easily made his visible on screen space, yet when i do exactly what he did it isnt visible. Anybody know why?

Changing to “screen” makes it disappear like normal, but it never avtually reappears.

Thanks