[MAJOR] material_block showing up as white color block.

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.

FORT-927936 has been created and its status is ‘Unconfirmed’. This is now in a queue to be reproduced and confirmed.

yeah this is a problem, pls fix

This is definitely an issue.

1 Like

Hello, Confirming that I am also getting this issue

I’ve noticed it is only happening on material_block widgets where the material is declared outside of the material_block.

I’ve also noticed that this only happens to widgets that are shown at game start.
For example when shown in OnBegin to all players or PlayerAddedEvent.


To add on I’m also experiencing jittering issues when refreshing UI. This happens when I show a new material block / texture_block while having the material defined directly inside of the material_block

Example: Widget:=material_block{DefaultImage:=MyMaterial{}}
Fix for the above:
Declare the material MatName : material = MyMaterial{} at game start as a constant which can be accessed anywhere.

Also have noticed inconsistencies in projects, some projects the material can be DefaultImage:=MyMaterial and sometimes it has to be MyMaterial{}

I’ve seen great potential so far with material_block and i’m really loving it so far. Please address these issues so we can have a better experience.