using { /Fortnite.com/Devices } using { /UnrealEngine.com/Temporary/UI } using { /UnrealEngine.com/Temporary/SpatialMath } # This is our main device. # It connects the viewmodel to the UI. device show_image_example : creative_device : # This is the image widget defined in the companion # User Widget asset. We reference it by its property name. # note: image_widget must match the widget variable name # set in your UEFN User Widget Blueprint asset. @editable ImageWidget : image = image{} # This texture is assigned in the UEFN editor Details panel. # Drag your desired Texture2D asset into this slot. # note: texture_2d is the real Verse type for a texture asset. @editable MyTexture : texture = texture{} # This function runs when the game starts. OnBegin() : void = # Step 1: Convert the texture to a UI image brush. # This is the magic translator! # It turns the texture asset into a 2D brush # that the image widget can display. # note: MakeImageBrushFromTexture is the real # conversion function from /UnrealEngine.com/Temporary/UI. ImageBrush := MakeImageBrushFromTexture(MyTexture) # Step 2: Put the brush on the UI image widget. # Now the image shows up on screen! ImageWidget.SetBrush(ImageBrush)