Skip to content
Documentation is work in progress. Information may be out of date and inaccurate.

Widget

The Widget class allows a very versatile way to create and use Unreal widgets as UI within the game.

///tip Note

Most parameters are not exposed in the Widget class, and should be called using the method CallBlueprintEvent(), which will call the specific underlying Widget method.

///

Examples#

Creating a Simple a Native Text and adding it to screen#

Client/Index.lua
local my_text = Widget(NativeWidget.Text)
my_text:CallBlueprintEvent("SetText", "Hello World!")
my_text:AddToViewport()

Tip

SetText is a method from UTextBlock, the Widget associated to NativeWidget.Text.

Creating a Widgets with Childs#

Client/Index.lua
local my_vertical_box = Widget(NativeWidget.VerticalBox)
my_vertical_box:AddToViewport()

local my_text = Widget(NativeWidget.Text)
my_text:CallBlueprintEvent("SetText", "Hello World!")

local my_button = Widget(NativeWidget.Button)

my_vertical_box:AddChild(my_text)
my_vertical_box:AddChild(my_button)

Using a WebUI as Image Brush#

Client/Index.lua
local webui = WebUI("mywebui", "https://google.com", WidgetVisibility.Hidden)

local my_image = Widget(NativeWidget.Image)
my_image:CallBlueprintEvent("SetBrushFromMaterial", webui)
my_image:AddToViewport()

Tip

SetBrushFromMaterial is a method from UImage, and expects a MaterialInstance as parameter. Passing WebUI, SceneCapture or Canvas converts it to it's internal Material automatically when being passed as parameter!

Subscribing for a Dispatcher#

Client/Index.lua
local my_button = Widget(NativeWidget.Button)

-- Puts a text inside of it
local my_text = Widget(NativeWidget.Text)
my_text:CallBlueprintEvent("SetText", "Press Me!")
my_button:AddChild(my_text)

-- Binds the native OnClicked dispatcher
my_button:BindBlueprintEventDispatcher("OnClicked", function()
    Console.Log("clicked!")
end)

-- Adds the button to viewport (will fill the whole screen)
my_button:AddToViewport()

Constructors#

Functions#

Events#

✅ NativeWidgets to Unreal Widgets Relation#

List of the relation Unreal native Widgets ↔ NativeWidget Enums:

Enum Unreal Class Is Panel
NativeWidget.Border Border ✅
NativeWidget.Button Button ✅
NativeWidget.CheckBox CheckBox ✅
NativeWidget.Image Image ❌
NativeWidget.ProgressBar ProgressBar ❌
NativeWidget.RichTextBlock RichTextBlock ❌
NativeWidget.Slider Slider ❌
NativeWidget.Text TextBlock ❌
NativeWidget.ComboBox ComboBox ❌
NativeWidget.EditableText EditableText ❌
NativeWidget.EditableTextMultiLine MultiLineEditableText ❌
NativeWidget.SpinBox SpinBox ❌
NativeWidget.TextBox EditableTextBox ❌
NativeWidget.TextBoxMultiLine MultiLineEditableTextBox ❌
NativeWidget.CanvasPanel CanvasPanel ✅
NativeWidget.GridPanel GridPanel ✅
NativeWidget.HorizontalBox HorizontalBox ✅
NativeWidget.Overlay Overlay ✅
NativeWidget.ScaleBox ScaleBox ✅
NativeWidget.ScrollBox ScrollBox ✅
NativeWidget.SizeBox SizeBox ✅
NativeWidget.UniformGridPanel UniformGridPanel ✅
NativeWidget.VerticalBox VerticalBox ✅
NativeWidget.WrapBox WrapBox ✅
NativeWidget.BackgroundBlur BackgroundBlur ✅

✅ List of Supported Parameter Types#

See all Supported Parameter Types in the Blueprint Page.