UI - Swappable Image that is always on screen?

I’m looking at HUD tutorials but they are not really giving me what I want. I’m after the ability to have a TGA (or whatever graphic file) to always appear in the bottom right and to be able to swap that image based on events in the game. Anyone have any ideas of what functions are required here so that I can look it up? No idea what to look for.

that its simple.

Create a variable “Texture” class Texture2D and switch casting to hud, or casting from hud to a variable where exist that event, how or the best way depend of where are the events how works your code.

I switch in my tutorial two images but On Overlap.

I made things like this in my inventory system, show on/off, switch on many events, but not yet in this tutorial. Anyway perhaps you can use something i already show in that tutorial, (its small) or get a idea.

Thanks for your tutorials. I was able to create my own HUD with “Inventory slot” texture in the bottom right. This is great but your HUD is about physically iteration, I’m trying to have other events within the game affect what texture it draws. For example,

Hud default is always empty inventory box. Then if I pickup a object in the game I want to replace that texture with another texture (inventoryslot with item X in it so the players knows what they are holding).

Any ideas how I can do this?

p.s Also, TGA works but not PNG. I think you got PNG to work fine didn’t you?

the basic idea its the same, but like i say that depend what do you want and how do you do that.

a easy example and two ways.

if you have one slot, and your hud are always drawing that slots, using a Texture2D variable we call it “LastItemPicked”, then you can create a variable “Texture2D” in “Mycharacter” and when your character pick a item you update that variable with a texture 2d image. Your HUD when draw that SLOTS must always “Cast To My Character” for get and “LastItemPicked” Variable and HUD going to use that for draw that slot.

another way and i think better

Create the “LastItemPicked” in the HUD BP and “cast to MyHud” from “MyCharacter” when you pick a object and “SET LastItemPicked” to the new texture 2d.

i haven’t problem with png/jpg/tga and others, UE4 eat all.

Thanks, I sort of understand but need some further help.

Bottom screen is my HUD. Have created a variable ‘Inventory_A’.

Top screen is my item blueprint that I’m going to pick up. You say to cast my HUD to enable the variable but where should I add the cast in this tree?

Even if I could do this I’m not sure how to proceed? Is the idea that in my HUD blueprint that I will have something like;

  • If Inventory_C is enabled use Texture_C
  • If Inventory_B is enabled use Texture_B
  • If Inventory_A is enabled use Texture_A
  • Otherwise enable Texture_Default

?

how do you get the item? on overlap? or how? i not understand what are you trying in BP_Item_A

in your HUD you only need a new var “Texture” type “Texture2D” set to default texture and connect to “Texture” in “Draw Texture”

Yes, the item would be picked up via trigger volume.

Is this closer to what you’re thinking? As a test, ‘draw simple texture’ has brick. ‘Draw Texture’ has Bush. Brick is default, when I pick up the object I will add a branch between these two that says if player has picked up the item then change the brick to bush?

No, wait a moment.

pd: but i think you need do the youtube tutorials in UE4 for get a more better base.

oYoE8xE.png

in the last false can be the default.

the method of branch can be better but that must works.

That looks great Knack, makes more sense now, will try it tonight. You mention youtube tutorials, any links? The only HUD based tutorials I can find are ones involving text rather than images.

yep only few of them, but i think you have lack of basic concepts, and you must begin for that. That going to help you to work with blueprints. no matter if its about HUD or other thing, your problem seeing that case its blueprints.

you going to lose more time figure and trying do things than watch all oficial blueprint tutorials in youtube. Try at least watch and understand, not need make step by step that tutorials (at least i not do)

I must have gone through about 3 hours of HUD tutorials (inc yours). I just can’t find that really simple explanation of how to swap an image. Some cover it (inc yours) but by the time they explain it the system is huge and more complex because I don’t understand all the other parts that are connected. I seem to have gone through all the main ones, but you’re right. It’s important to go through lots of these tutorials as you get familiar with little pieces here and there and the more you do the more I can learn how to bring it all together. Which I have been doing!

Well, after many failed attempts and numerous tutorials I finally figured it out! I think from this I should be able to figure out how to turn it back to default at another trigger which is good. Hopefully :slight_smile: