How to Change SWindow Icon

Hi,

When I create a window with SWindow and show the default title bar. There will be an unreal default icon on the left of the title bar.

Is there any way to change it to my own icon?

Sincerely,
Patrick

HI @patrickzw ,
I think what you’re looking for is in Project Settings, Platforms, Windows. In the Game Icon option, you can assign your own .ico file to change the window icon as you like. Make sure the icon is in .ico format (not .png) and sized at 256x256. (You can convert it from other formats using online tools if needed).


Hope it helps!!

Hi @BRGEzedeRocco ,

Thanks for the reply.

I did change this icon, but this only effect the main game and exe icon. It will not change the slate window icon. The window in the image is a window I create using SWindow class.

    FSlateIcon Icon("MyStyleSet", "MyCustomIcon");
    
    TSharedRef<SWindow> MyWindow = SNew(SWindow)
    .Title(FText::FromString("My Window"))
    .ClientSize(FVector2D(600,400))
    .CreateTitleBar(false)
    .SupportsMaximize(true)
    .SupportsMinimize(true);
    
    TSharedRef<SWidget> TitleBarContent =
        SNew(SHorizontalBox)
        + SHorizontalBox::Slot().AutoWidth()
        [
            SNew(SImage).Image(Icon.GetIcon())
        ]
        + SHorizontalBox::Slot().AutoWidth().Padding(6,0)
        [
            SNew(STextBlock).Text(FText::FromString(TEXT("My Custom Window")))
        ];

    TSharedRef<SWidget> MainContent = SNew(SVerticalBox)
        + SVerticalBox::Slot().AutoHeight()
        [
            SNew(SImage).Image(Icon.GetIcon())
        ]
        + SVerticalBox::Slot().AutoHeight()
        [
            TitleBarContent
        ];
    
    TSharedRef<SWindowTitleBar> TitleBar =
        SNew(SWindowTitleBar, MyWindow, TitleBarContent, HAlign_Fill)
        .ShowAppIcon(true)
        .Visibility( EVisibility::Visible )
        .Title(FText::FromString(TEXT("Test title bar")))
        .Style(&FCoreStyle::Get().GetWidgetStyle<FWindowStyle>("Window"));
    
    MyWindow->SetTitleBar(TitleBar);
    MyWindow->SetContent(MainContent);

    FSlateApplication::Get().AddWindow(MyWindow);

Here is the function I use to create the window and try to apply the icon for the title bar. For testing, I also set the content for the winow to see if everything is working. And here is the image of that window.

You can see there is no title bar and the icon image is working fine and also the title bar has content, but none of them are show in the title bar.

Did I make any mistake?