I implemented a UMG widget that allows the user to choose colors for their character. I’ve got it working in-editor, it looks like this:
It’s pretty simple, basically I just generate the colors in my menu widget and create a little sub-widget with a button and an image for each one and set the color. Clicking on the button reports back to the parent widget.
In a packaged build, however, it shows up like this:
The strangest part is that I can confirm that the correct values are actually being generated and passed into the sub-widget. They are correct in the logs, but they appear black once they are passed into the image widget. Additionally, the sub-widgets are nearly identical to buttons shown on the left, which look fine. The sub-widget color is saved in an FLinearColor variable and passed back on click, and that works fine too.
What happens next, however, is very very strange. What happens in-editor is that the color gets passed back to the parent widget and displayed, then added to a struct and saved to a json file. In the packaged build this happens dozens of times in a row… and each time the selected color is different until it lands on (0,0,0,1)… black. Black is then displayed in the parent widget.
I’ve just confirmed that enabling Event Driven Loading fixes this problem completely. Unfortunately Event Driven Loading also breaks my entire game on some computers (as detailed [here] and [here]) so that’s not really a solution.
UPDATE Enabling Blueprint Nativization for both widgets seems to have also solved this issue, even with Event Driven Loading off. This makes me think it’s related to the bug detailed [here]. According to the [issue tracker] that issue was supposed to be resolved in 4.18. Updating to test will be a long and complicated ordeal.
I was unable to reproduce the issue you are experiencing. I have a couple of questions to help narrow down the issue you are experiencing.
- Are you able to reproduce this issue in a new project?
- If so can you provide a detailed list of steps so that I can reproduce this issue on our end?
- Are the colors on top of the buttons just image components?
I have not tried this in a new project but the steps would be as follows:
disable the event driven loader and blueprint nativization
create a parent umg widget containing a uniform grid component
create a child umg widget with a button as root and containing an image component
spawn the child widget from the parents blueprint graph and add it as a child to a uniform grid component
pass an FLinearColor into the child via a public function and use it to set the image component color
package the project
(yes the colors on the buttons are just image components)
This is on 4.17.2
The repro steps you provided did not reproduce the issue you are experiencing on our end. Can you try to reproduce this issue in a new project?
Hello again SlimeQ,
I want to share my process for reproducing your project to see what I may be doing differently than what you are. I have created two widgets, One as the parent which holds a uniform grid inside of a canvas panel, then I created a second widget that is a button as the root with an image as a child of the button. Next, in the EventGraph of the parent, I create the sub-widget and then add it as a child to the uniform grid. Then I created a new function inside the parent widget that allowed me to set the color of the image.
In the level blueprint for an empty level, I create the parent widget and add it to the viewport, after which I package the game. I have also attached images of my blueprints. Does this setup differ from what you are using to experience your issue?
I was passing the color from the parent to the child via the function, not sure if that would make any difference.
The critical part that you did not mention however is disabling event driven loading.
Due to its apparent relation to event driven loading, I believe the bug has something to do with the way the colors are being loaded in a subwidget.
Where you able to reproduce this issue?
I still haven’t tried. I put this bug on the back burner because it was effectively fixed in 4.17 by turning on blueprint nativization for the widgets. However, I just upgraded to 4.18 to find that nativization now breaks packaging, so I had to disable it. And now, of course, this bug is back.
I’ve been told that the 4.18 nativization bug is caused by upgrading from an older engine version and fixed by migrating everything to a fresh project. This leads me to believe that this color bug may be just a symptom of a bad blueprint that’s been through several upgrades. If you followed my steps exactly and packaged with event driven loading disabled and could not recreate the issue then this seems likely.
I can not stress enough though that this is just one bug on a pile, all caused by disabling event driven loading. It also broke default fonts in text render components (which I detailed here) and caused a crash on StaticLoadObject which I use to load up thumbnails for mods. And event driven loading had to be disabled because builds with it enabled were crashing on launch on only specific user computers. That bug is detailed here.
I can try to recreate this bug but I’m not entirely sure it’s worth it because there’s clearly something very wrong on a very deep level.