I’ve just created an interface using UMG, but I’m stuck with a certain aspect…basically, I have it so when you press 1 it will cast fire, press 2 it will cast sparks and so on, but I want it so when you do actually press let’s say ‘1’ it will highlight within the spell interface indicating the player they have used that specific spell. I was wondering if anyone could help me with this?
Create an event for your spell in your blueprint and trigger it with the key press. Create two Linear Color Variables, one for normal, one for highlighted, then when the event triggers, set the brush color to the highlighted one, and on release set it back to normal.
Hope this helps
I’m still very confused on how to do this. Here’s a list of variables that I have in mycharacter blueprint. p.s I only briefly started using blueprints.
UMG is where you will be doing the color swapping, Player controller will be calling it.
Here’s something quick I tossed together to demonstrate my previous point:
This is a blank widget, I dragged a border inside of it, called it SpellSlot and made it a variable to have access in the event graph.
Inside my widget I created two linear color variables, normal and highlighted. I set normal to be white. Then I made two events to swap between them when the hotkey is used.
Made a default player controller that will be creating my widget and store it inside a variable of my widget blueprint. This is necessary to call the previous functions on it. Then I bound the 1 key on the keyboard to call the highlight and stop highlight from the widget.
Here is the widget in action!
This is just not working. This isn’t the same target as yours.
Everything else is fine. I did attempt to play the game, but the button just disappeared.
Make sure that your colors are not set to have an alpha of 0.
it works! However, how would I go and implement a texture for the border such as a fire texture, but when you press ‘1’ the outliner will highlight, not the entire thing.
A border widget slot has room for one child. You can make the border itself have the texture of your fire border then you could put an image inside the border with your spell texture, that way only the border will get the brush color change, not the image!
Figured it out, thank you so much! I wish I had a better understanding of blueprints.
Practice makes perfect!
Feel free to mark this as solved
I don’t know how to mark the question as solved…if you tell me how to do it, then I’ll do it.
No problem, go up to my original answer and click the checkmark