drawing and changing GUI texture depending on a bool

So I have two different 256x256 images for the GUI that I want to change depending on the current state of a bool in the level blueprint. I haven’t had much luck finding out how exactly to accomplish this, let alone drawing the GUI in the first place. I’m pretty new to UE4, and I really don’t have much time to finish this game.
Some help please?

Alright before I answer let me say that using a guy in the levelblueprint is really bad practice. You probably want to use either a bool in your HUD which you set from your level blueprint or ideally you do everything in your character, controller and HUD.

That said there is a really simple way to this. “Select Texture”. It takes two textures and a bool. If the bool is true it selects texture A otherwise it will select texture B and output it.

From there you can simply use a “Draw Texture” right behind a “Event Receive draw HUD”. As texture you simply use the way I just explained.

If you want to do it more fancy and also a lot easier if you want more than a simple texture you should use a widget. You can drag and drop everything together as you want it and then as events change for example the texture.

…though if you are really short of time you probably want to use the texture only.

I hope this helps. I’ll be on till maybe 4 and then again tomorrow most of the day so just ask again if you run into further trouble or have a more direct question :wink:

Cheers

Pull out a line from your texture and search for “Select”.

There really should show something up.

Where exactly is “Select Texture?” I’m searching for it and nothing’s coming up.

Closest that comes up is “Select Object.”

I tried Select Object and it won’t let me connect it to Draw Texture.

Even if I use a texture variable, all that comes up is “select object.” It’s like Select Texture doesn’t exist at all for some reason.

Actually “Select Object” comes up with a texture reference.

How does “select object” pop up with the context menu if you have a texture?

Are you sure the context checkbox is enabled and you use the pin from your texture?

Could you make a Screenshot of your variable and the node selection box when you search for select?

Otherwise just to have it work simply use a branch and two draw texture nodes. Not perfect but it works.

I tried it out with just “Select” and it only drew the first image. Select Object doesn’t work because as far as I know there’s no way to convert an object reference to a texture reference.

25082-selectobject.png

Also, I tried to do the branch method and it only ever draws one of the textures.
Additionally, in the level blueprint, I started receiving an accessed none error when trying to change the bool that determines the texture despite it working earlier.

25085-accessed+none.png

Ok two things.

First I’d like to see your variable details.

And then you will have to fill the variable and not just create it. Your errors are there because nothing is inside of that variable. It’s a reference to none or null which are will result in an error if you try to do something with it other than removing a m material from a mesh.

Of course it doesn’t. Why is your texture reference an object? I am completely confused…

Or did you mean the texture details.

25128-texture+details.png

Both look fine so far.

A different question. Are those variables not inside of your hud?

You shouldn’t need an additional variable for that as only one hud can be active at a time this means any functionality in a second hud won’t be called and you also won’t have or get variables from a second one.

At least not with blueprint which also isn’t necessary since widgets.

The textures and bool are in the HUD blueprint. All other variables at the moment are in the level blueprint.

How did you fill your main hud variable?