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<override>()<suspends> : 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)
Verse Library
verse
01 Fragment
Dynamically assigns a texture to a UI image widget for viewmodel or HUD displays.
verse-library/conversion-functions-showing-textures-from-a-viewmodel/01-fragment.verse
Sign in free to read the full source 🌴
This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.