Summary
Widgets using material block sometimes show up as white color blocks instead of displaying a material.
This happens consistently for join in progress players regardless of implementation for me in edit sessions.
I will provide a simplified implementation of how I usually handle ui below.
Please select what you are reporting on:
Creative
What Type of Bug are you experiencing?
Assets
Steps to Reproduce
ui_component <public> := class<abstract><unique><castable>:
Container <public> : widget
Widget <public> : widget
Show<public>():void
Hide<public>():void
InitiallyVisible <public> : logic = false
overlay_component <public> := class<abstract>(ui_component):
Padding <public> : margin = margin{}
HAlignment <public> : horizontal_alignment = horizontal_alignment.Center
VAlignment <public> : vertical_alignment = vertical_alignment.Center
Container <override> : overlay
Show<public>():void=
Container.AddWidget of overlay_slot:
Widget := Widget
Padding := Padding
HorizontalAlignment := HAlignment
VerticalAlignment := VAlignment
Hide<override>():void=
Container.RemoveWidget(Widget)
#Has never worked for me since the release of the feature
material_block_test <public> := class(overlay_component):
Widget<override> : material_block = material_block:
DefaultImage := SomePath.SomeUIMaterialHere{}
DefaultDesiredSize := vector2{X := 512.0, Y := 512.0}
#Usually works for me but annoying to have to do this.
lazy_initialization_test <public> := class(overlay_component):
Widget<override> : material_block = material_block:
DefaultImage := SomePath.SomeUIMaterialHere{}
DefaultDesiredSize := vector2{X := 512.0, Y := 512.0}
var CachedMaterial : ?SomePath.SomeMaterialHere = false
Initialize():void=
NewMaterial := SomePath.SomeMaterialHere{}
set CachedMaterial = option{NewMaterial}
Widget.SetImage(NewMaterial)
Show<override>():void=
if(not CachedMaterial?){Initialize()}
(super:)Show()
player_ui_container <public> := class:
Owner : player
Overlay : overlay = overlay{}
var UIComponents : []ui_component = array{}
Initialize<public>():void=
Components := array:
material_block_test{Container := Overlay}
lazy_initialization_test{Container := Overlay}
set UIComponents = Components
for(Component:Components, Component.InitiallyVisible?):
Component.Show()
Show()
Show<public>():void=
if(PUI := GetPlayerUI[Owner]):
PUI.AddWidget(Overlay)
Hide<public>():void=
if(PUI := GetPlayerUI[Owner]):
PUI.RemoveWidget(Overlay)
Expected Result
DefaultImage Properly Displays The Material Used To Instantiate a material_block
Observed Result
Defaults To A White Color Block.
Platform(s)
Windows
Upload an image
Additional Notes
I’m currently using something closer to the lazy initialization example provided.
Not sure if this is an inheritance issue either? It also seems to happen randomly in live codes too which ruins the experience for my players. I have provided some screenshots of it in both good and bad states.
You can consistently replicate this issue currently in 36.10 by initializing a material block for a join in progress player in an edit session and attempting to show it to them.