Menu Colors are not updating

Hello Everyone! so I am running into a strange problem with my menu colors. I want the player to be able to change the color of their menu and it “works” for the most part.

Here are some screen shots because it is easier to show then tell this problem…




Here are the current screens with the original color


And here are the screens with the new color

All these images and borders that help make up these buttons will sometimes be the original color after the change. Now I suspect that the issue lies in the button hover/unhover function I created to allow for the custom color change as I cannot bind button style colors to the menu color here is the BP for the bind as well as the Hover/Unhover function and the bps from the settings menu for changing the color


Bind Function


Hover/Unhover Function


Button press to change color


And finally the BP that changes the color in the player struct

If anyone could give me insight into how to properly refresh the widgets I would appreciate it.

Can you quickly test it without any animations?

So I went ahead and tested it without animations but the problem persisted.

Hover / unhover might be a better choice; binding would trigger every frame, non-stop, for the rest of the game or, at least, for as long as the widget is visible in the viewport.

Have you done any debugging? Even a simple print string helps visualising whether you’re feeding the right border the right colour.

Not sure if we’re seeing the whole picture of how this is supposed to work here, are any of those elements dynamic?

How are you iterating through all those borders? This might be critical, seeing how only some of them respond:

Just to clarify, these did not turn red, right?

That is correct those did not turn red. After more testing it seems that if I hover over them before changing the color they will keep the previous color. But according to the print strings i used they are still using the menu color. All I can think of is that when the hover/unhover function is used it unbinds the bound value to the border. As to how they are iterated through i use the button hovered and unhovered event to cause the changes in the hover/unhover function.


Each button has this bit of code.

I incorrectly assumed you’re recolouring the entire menu in one go. Not sure why this is happening but there is a much more organised and organic way of dealing with what you’re doing.

Consider the following:

  • this is a custom button widget, we use it instead of the regular button:

image

  • the colour changing script goes inside:

Now every button knows what happens when it’s hovered / unhovered. Populate the menu with those custom buttons instead. You can expose data on those buttons to make them more unique, each can have a different image / text when added to a panel.

This way you do not need to duplicate any script or create things like:

image

The buttons’ parent should not even care that its child is changing colours.

So while implementing these new buttons I figured out what the problem was. The hover/unhover function was overwriting the bound values for the color of the borders. So now instead I just added the code from the Hover/unhover function to the bind code and the button hover and unhover events now just change the bool to change the colors within the bind function.

I appreciate the help, I don’t think I would of figured it out without implementing these buttons.


Here is what i put into the color bind for the border for anyone who comes across this

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.