I need to change the UI text color for each level. Currently I’ve made a function out of the color similar to UMG - How to change text color with OnUnhovered? - UI - Epic Developer Community Forums
I then wanted to use a variable to select what colour based on the level loading.
I’m new to UE so not sure if this the best way to do it.
Hey there, welcome to the Unreal 4 community!
You can create a custom event or function that checks which level you are currently in and set the color variables based on that.
Using this node:
If this is not enough info, I can try to give a more in-depth explanation.
-SamuelB
That’s very useful, currently I’ve got something like this.
A more detailed explanation would be amazing, I’ll keep on working on it.
Ok that looks pretty good, you need to connect the get current level Node before the return node.
Then branch off the return value of the level name, if it is equal to “level1” set the selected color, if it is not, branch off the false execution and check if its equal to the next level etc.
Something like this maybe:
Hopefully this helps, let me know if you run in to trouble.
-SamuelB
Hey there,
If you just want to call it once instead of constantly updating it through bindins, you can run that same code from EventConstruct (if you’re using a widget blueprint) or EventBeginPlay (if you’re using a normal blueprint). I’m assuming you’re using widgets though, so you’d go with the former. Here’s an example:
In this case, “YourText” is a Text widget that I added to the canvas of the widget blueprint. But you can do this for nearly every widget type (image, progress bar, text, etc.). Hope you find that useful!
Yea adding to the construct should work