Download

Creating a context-sensitive UI?

Hi all,
I have been trying to set up an item interaction system and I’m working on one that has an item parent class blueprint with the functionality and children classes for different objects you can interact with. However, I’d like to show different icons depending on the item - a gun icon for a weapon pick up, a medical icon for a healing pick up, etc. Does anyone know how I’d do this in the UI blueprint? Thank you in advance, any help will be appreciated!

He also made a youtube tutorial series starting here https://www.youtube.com/watch?v=seXX_iWM4Fw&t=3s

Thanks very much for the quick response! I’ll definitely check out the video and tut and see if I can apply it :slight_smile:

Well, looking at the tutorial, I don’t think this is quite what I had in mind, but that was most likely my fault for not explaining myself properly. At the moment, I have a UI that pops up a little reticule when you get close to an object (see attached). Instead of just a circle, I’d like it to display a different icon depending on what the pickup is, to show the player what type of item they’re close to. Thank you for the links though, I have no doubt they will still come in handy for the future :slight_smile:

I’m guessing what you have right now is a base parent class with a widget attached to it that becomes visible when the player is close. Is there a reason why you can’t change the icon the widget uses on the children? Or if you have a lot of items, what you could do is something like this. Create multiple subclasses (weapon, consumable, etc. and when you make the widget visible, cast to each of those and change the icon based on it’s parent class or something.

Yeah, you’re right, that’s how it’s working right now and your suggestion sounds more like the action I was after :slight_smile: I’ll try casting to them when I get a chance and see if that works - it seems like the best approach! When I’ve tried it, I’ll report back. Thanks for the advice :slight_smile:

I managed to solve it. As it turns out, if you make a new UI blueprint you can attach it to the child in the details panel under user interface → widget class. If you change it for the child class, it will naturally only affect the child. I am face palming so hard right now, but I’m gonna go ahead and blame my fatigued brain… thank you for all the help. You are a gentleman, sir. Or a gentlewoman, of course. Either way, very much appreciated.