Download

How would you go about creating in-world UI prompts?

So I’m trying to implement this in my game, and would like a few pointers on where to start or what techniques, etc. I can explore. Basically, I just want to show action prompts in-world whenever an action is present. For example in Ghost of Tsushima or really any other game with such a feature, whenever you’re near a grapple point, a prompt would appear with the button to press if you want to grapple to that point. I just need a little direction, and any input is greatly appreciated.

Thanks!

Widget componentthat turns on/off based based on some logic. Probably would be easiest to just use a sphere collision volume and turn it on/off based on overlap event.

@Arkiras Thanks! I started working with it and gfot pretty much what I wanted, except that it doesn’t automatically orient itself towards the player. I can probably write some code in Tick for it to keep updating its orientation to face the player whenever they’re in vicinity, but that seems terribly inefficient. I looked through all the properties in the BP but there’s no apparent option to set it to behave that way. What would the most efficient or “standard” way of achieving this be ?

Nah, no need for anything complicated, if you click on the component it has a setting called “Space”, if you set it to Screen then it will always face the player (and be a consistent size)

UE4_WidgetComponent.png

I thought it was screenspace by default but I guess not. Note the description: It can’t be occluded. So if you have a really big radius you might be able to see it through walls, if that isn’t what you need then you might have to run a trace to the player or camera (I’d use a timer rather than tick) to turn it off, not sure of a better way to do it.

Edit: Just thought of a couple other ways you could do this, one would be to use a billboard component that you turn off and on. This won’t be a consistent size but it will occlude without having to trace. Another similar option would be to use a Plane mesh component with a billboard material on it, same idea, but doing the camera facing logic in the vertex shader is dirt cheap.

I still think the widget component is probably the best approach, but if you need occlusion and can’t afford to trace that would be a good alternative.

Made a simple example for the vertex shader material if you want to go that route instead:

Again though, I would just use a Widget Component. Even if you have to trace on tick to get occlusion, line traces are pretty inexpensive.

@Arkiras Thanks a ton for all the effort. I did actually try setting Space to “screen”, but I don’t see anything at all in that setting, from any angle. :frowning:

No problem! In regards to it not showing up, only thing I could think that might be wrong is that it could be trying to render the widget offscreen, I would try making a widget class that has no canvas panel (so no anchors) and setting its render transform to 0,0

Not sure it will help, but here is what I’m using in my project:

(It looks empty, but that’s because I populate the list at runtime)

If that fails… I don’t know what the issue could be. Sorry :frowning: Hopefully someone more knowledgeable will chime in