All skills
quodsoler avatar

/ue-ui-umg-slate

@f3742d7

Use when writing or fixing Unreal Engine UI in C++ — UMG user widgets, Slate widgets, Common UI screens, or MVVM view models. Also use when the user mentions 'UUserWidget', 'NativeConstruct', 'BindWidget', 'CreateWidget', 'AddToViewport', 'ESlateVisibility', 'OnClicked', 'UListView', 'widget animation', 'SNew', 'SLATE_BEGIN_ARGS', 'SCompoundWidget', 'UCommonActivatableWidget', 'activatable widget stack', 'UCommonButtonBase', 'gamepad focus', 'FUIInputConfig', 'UMVVMViewModelBase', 'FieldNotify', or 'WidgetComponent'. For input modes and Enhanced Input, see ue-input-system; for Slate in editor tooling, see ue-editor-tools.

Use this Skill: https://skilld.dev/gh/quodsoler/unreal-engine-skills/ue-ui-umg-slate

This session only. Nothing lands on disk.

referencesslate-patterns.md

≈559 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Slate Widget Patterns

A complete custom Slate widget: a button with a bindable label, an initial enabled state and a press event. It shows the three SLATE_BEGIN_ARGS argument kinds, SNew / SAssignNew, slot syntax and a CreateSP click binding. SMyLabelButton has no module API macro, so it is private to its module; add MYGAME_API if another module constructs it.

// SMyLabelButton.h
#pragma once
#include "CoreMinimal.h"
#include "Widgets/SCompoundWidget.h"
#include "Widgets/DeclarativeSyntaxSupport.h"

class SButton;

class SMyLabelButton : public SCompoundWidget
{
public:
    SLATE_BEGIN_ARGS(SMyLabelButton)
        : _LabelText(FText::GetEmpty())
        , _bStartEnabled(true)
    {}
        SLATE_ATTRIBUTE(FText, LabelText)       // TAttribute<FText>, supports _Lambda binding
        SLATE_ARGUMENT(bool, bStartEnabled)     // Plain by-value argument
        SLATE_EVENT(FSimpleDelegate, OnPressed) // Delegate argument
    SLATE_END_ARGS()

    void Construct(const FArguments& InArgs);

private:
    FReply HandleClicked();

    TAttribute<FText> LabelText;
    FSimpleDelegate OnPressed;
    TSharedPtr<SButton> ButtonWidget;
};

// SMyLabelButton.cpp — #include "SMyLabelButton.h", "Widgets/SBoxPanel.h",
// "Widgets/Input/SButton.h", "Widgets/Text/STextBlock.h"
void SMyLabelButton::Construct(const FArguments& InArgs)
{
    LabelText = InArgs._LabelText;
    OnPressed = InArgs._OnPressed;
    ChildSlot
    [
        SNew(SVerticalBox)
        + SVerticalBox::Slot()
        .AutoHeight()
        .Padding(4.f)
        [
            SAssignNew(ButtonWidget, SButton)
            .IsEnabled(InArgs._bStartEnabled)
            .OnClicked(FOnClicked::CreateSP(this, &SMyLabelButton::HandleClicked))
            [
                SNew(STextBlock).Text(LabelText)
            ]
        ]
    ];
}

FReply SMyLabelButton::HandleClicked() { OnPressed.ExecuteIfBound(); return FReply::Handled(); }

Using it from another widget, with the label bound to a lambda so it re-evaluates every paint:

SNew(SMyLabelButton)
    .LabelText_Lambda([this]() { return FText::AsNumber(Score); })
    .bStartEnabled(false)
    .OnPressed(FSimpleDelegate::CreateSP(this, &SMyPanel::HandlePressed))

Source: SKILL.md on GitHub

No alerts2d5 checks · Risk SAFE
  • Gen Agent Trust Hub2d

    The skill provides comprehensive instructions and reference material for developing user interfaces in Unreal Engine using UMG, Slate, and the Common UI plugin. No security risks or malicious patterns were detected.

  • Socket2d

    No alerts

  • Snyk2d

    Risk: LOW · No issues

  • Runlayer6mo

    3 files scanned · No issues

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at f3742d7. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 days ago.

Activeupdated 3 days ago
metadata
{
  "version": "2.0.0",
  "engine": "5.8"
}

README badge

README badge for quodsoler/unreal-engine-skills/ue-ui-umg-slate