#slate

1 messages · Page 25 of 1

quaint zealot
#

Lmao, nevermind, SImage expects FSlateColor

opal ledge
#

these can be used finally inside BP ? Slate styles didn't worked before with UMG ?

mild oracle
opal ledge
#

oh

verbal veldt
#

question

#

what would I use for using an image for a ui background instead of a color/

#

I used SImage for the background, but would rather have an actual image

warm vault
#

You can set contents of a SBorder, including a .BorderImage

verbal veldt
#

@warm vault could you send a link or guide to how I would set an image up to be called like that

#

or if anyone else can help

ashen sedge
#

Hey everyone, I recently started but got a few things up on the screen just fine but my question is, how do you guys size stuff exactly? It seems like SizeBox isnt supported? Currently trying to set a size for a progress bar

quaint zealot
#

SBox

ashen sedge
#

I surprisingly tried that but it doesnt let me do + SBox::Slot(). I'm obviously missing something though and I apologize for that, could you please point me in that right direction?

quaint zealot
#

SNew(SBox).WidthOverride(x)[ /* stuff ]

#

Search through the engine code for Slate examples

#

Lots of it

ashen sedge
#

Thank you very much

#

I actually started by looking through Helium Rain but realized I needed to learn the basics before I can understand it, just wanted to thank you for sharing that as well.

quaint zealot
#

Yeah the basics can be difficult to learn

warm vault
#

would you happen to know some files that have good examples? tried looking myself but there's so many modules ...

quaint zealot
#

Depends on your goal with Slate really

#

For game UI since that's not recommended there aren't many and all I can suggest is the Helium Rain source

#

For editor plugins there's a lot more stuff

warm vault
#

what do you mean by not recommended, is UMG preferred unless you're doing editor plugins? i have a heavy UI game so wanted to learn slate better and you mentioned to search through the engine code for slate examples cuz there's lots of it except it seems pretty hard to find em. was hoping you could point me to a folder or something so i could find em easier if you know any

quaint zealot
#

Yeah UMG is your main entry point for game UI

#

You can use Slate to create custom widgets and expose them through UMG when you need custom behaviour

#

For the most part, you'd look at how a similar UMG widget is implemented in source code, mirror that and do the same for the underlying Slate widget

warm vault
#

if you need a lot of updating UI, slate is still preferred tho, right? doesnt uproperty bind widget start stacking up heavily since it checks every frame so updating ui from UMG starts hurting? i mean i know i shouldnt be optimizing till theres an issue, but my game is heavily UI based and i really dont want to run into an issue down the road and have to convert 30% of my UMG's to slate and have to learn it later, sounds better to just learn it now and not have issues?

quaint zealot
#

Yes, UMG bindings have an additional cost

#

Slate is still not preferred because you basically can't tie it easily to content or animation

#

If your game is very UI intensive, you probably do want a lot of Slate stuff, but it might be worthwhile to keep the UMG layer above

#

If only to animate stuff, set content resources and position widgets on the screen

warm vault
#

ah that makes sense. im assuming you mean setting content resources in code is a pain if you ever move anything so its much easier in a BP where there's no fixed file path? is it possible to create the widgets and everything in c++, well i know it is, but after that can i use something like CreateDefaultSubobject to create the widget inside my c++ class and then create a BP based off my c++ class and link images and what not directly in BP but have all the variables created in c++ so i dont have to bother with bindings and such?

quaint zealot
#

What I'm saying with content is, Slate doesn't work well with UObjects, so materials or textures need to be explicitly handled for GC

#

Basically you need UObject classes that are owned by the player controller or HUD just to store your content UObjects

warm vault
#

oh, that does sound like a pain

quaint zealot
#

Basically what I'm saying is, Slate is useful, but Slate alone without UMG as a nice Blueprint-enabled layer is problematic

long smelt
rare delta
#

Hi guys, I'm making a VR game and I'd like to make a user interface with health bar, score etc. I tried it with regular widget attached to viewport with method "AddToViewPort()" in C++. It works perfectly in "Selected Viewport" but its not showing in VR Preview (with Oculus).

Another way - I tried attach UI widget to camera component - it works fine in VR, but then widget is changing with change of light in world and something can walk into the space between player's camera and the widget and then player does not see the widget.

My question is: Is this the only way how to make user interface (health bar, score...) in VR? I'd like to do something like "AddToVRViewport()"

Btw I found only this in UE4 doc, so it seems, this is really the only way to make widgets, HUD and whole user interface in VR... :/
https://docs.unrealengine.com/en-US/SharingAndReleasing/XRDevelopment/VR/DevelopVR/VRCameraRefactor/index.html

Information on attaching items to any HMD.

gritty frigate
#

Does anyone know how I can have a widget that locks the mouse to the widget bounds while a mouse button is down, but still allows interaction with widgets below it?

I tried having OnMouseDown()/OnMouseUp() return FReply::Unhandled()LockMouseToWidget()/ReleaseMouseLock(), but with this, I found that nothing was passed through to the widgets underneath

ashen sedge
#

Haven't tried it myself but maybe CaptureMouse() to send your mouse events further? Would have to specify the widgets underneath tho

gritty frigate
#

Ah - I think my issue was that I was doing it in an SOverlay, and it was only giving the option of taking interaction to parent widgets, not to ones in Overlay slots underneath

royal vale
#

I have this line of code which compiles but crashes at runtime...
TSharedRefSOverlay::FOverlaySlot OverlaySlotRef = MakeShareable(new SOverlay::FOverlaySlot());
The log says, Fatal error: CoreMisc.cpp] [Line: 381] The TSharedRef() constructor is for internal usage only for hot-reload purposes. Please do NOT use it.

But I'm not using the constructor, and I see this pattern used elsewhere without issue. This is being called inside another SWidget. Not sure why it doesn't work

amber viper
#

Anyone know if Slate.EnableGlobalInvalidation is intended only as a debug aid, or can/should it be used by a shipping product? Are there any differences between using the console command vs wrapping my entire HUD in an invalidation box manually? Invalidation boxes aren't as well documented as I'd like...

gritty frigate
royal vale
#

Thanks for the reply. I am making the slot from within the Widget class that the slot is in, not sure if I understood you correctly. Only reason I was trying a TSharedRef is because that's what the SOverlay::Slot() static function returns, and is what I am replacing. All of this/Slate is completely new to me so I am unsure of most of this

gritty frigate
#

Give me a couple of hours and I’ll give you some example code of where I’m holding onto a slot for later use

#

Feel free to ping me 2 hours from now if I haven’t got back to you

royal vale
#

no rush, I'll be offline for a while

#

and thanks in advance

#
TSharedPtr<SOverlay> MyOverlay = SNew(SOverlay)
    + MyOverlaySlot.ToSharedRef().Get()
    .VAlign(VAlign_Top)
    .Padding(FMargin(0, 0, 0, 0))
    [
        MyImage.ToSharedRef()
    ]
;```
#

I'm not sure if this is more correct, but I was able to run without crashing, except for when I close the window I get an Access violation when it's trying to call delete on the object during shutdown.

gritty frigate
#

So this is how I'm doing it myself:

#
TSharedPtr<SConstraintCanvas> MyCanvas = SNew(SConstraintCanvas);
SConstraintCanvas::FSlot* MyCanvasSlot = MyCanvas->AddSlot()
  .Alignment(FVector2D(0.f, 0.f))
  .Anchors(FAnchors(0.f, 0.f))
  .AutoSize(true)
  [
    Content.ToSharedRef()
  ];

Because the slot is stored in the SConstraintCanvas by value, and AddSlot() returns a reference, putting it into a TSharedRef/TSharedPtr is dangerous, as it's mixing up responsibility. Keeping it as a raw (non-owning) pointer anywhere else is safer here, as you won't end up with a double delete.

#

^ Pinging @royal vale for when you are back online

orchid nova
#

Is there some way to get the current SScrollBar out of a STileView? I'm trying to figure out how to change the color of the scrollbar for a UMG UTileView but man this looks so incredibly complicated...

#

I managed to figure out that RebuildListWidget is where the STileView seems to be created, but it goes into some confusing mess of templates that I cannot parse

mild oracle
#

I'm trying to find the Monitor Index that is being used to display SWindow.
I've got a hacky way checking its position and the WorkArea of each FMonitorInfo but I wonder if there's a smarter way that anyone knows of. Trying to let players set their preferred monitor and it's a Lot.

loud relic
#

where do i post my question about UI material texture tiling? #umg or #slate

#

how do i make my button material texture tiled evenly ( like 5x5 px pattern tiled inside of a button)

#

like for example here

#

how do i make button background like this hexagons? no matter what button size, the pattern tiled evenly?

royal vale
orchid nova
#

Yeah I'm rapidly discovering it's a total mess and I need to literally copypaste everything if I want to make anything out of it

royal vale
orchid nova
#

although I found that there is an ExternalScrollbar option on the STileView, but I didn't have much luck with setting that yet 🤔 could just be that I did something wrong because I've barely touched Slate before this

mild oracle
#

How does everyone deal with converting UENUMs to FText in editor plugins?
I want to display the value of a enum in a user-friendly way

gritty frigate
#

I this for a ComboBox?

#

Usage is:
SMyEnumComboBox<ESomeEnum>

#

You've got .InitiallySelectedItem which takes a straight enum value, as does onSelectionChanged give you

mild oracle
#

@gritty frigate no it's not for a combo box, it's for adding a warning
FString DisplayStr = UEnum::GetValueAsString<EBUIStyleDisplayType>( TextStyle->GetDisplayType() );
This kind of works, but it outputs "EBUIStyleDisplayType::Display" rather than just "Display" or the DisplayName text I define in the UMETA :/

#

I'll try GetDisplayNameTextByValue

gritty frigate
#

Ah - okay - yeah - that’s the one

quaint zealot
#

TIL that OnMouseWheel doesn't let you fetch the FKey for MouseScrollUp/MouseScrollDown

quaint zealot
#

Anyone aware of whether you can have a styleset that has /Content/A as root path to find brushes, etc ; but uses /Content/A/B for style assets ?

mild oracle
quaint zealot
#

My problem is that while GetBrush is fine with subdirectories, GetWidgetStyle doesn't look like it is

#

I was fine with it until now, but GetWidgetStyle is used for rich text and so every inline image in the entire game would need to be at the top level UI folder

#

Now I could create another styleset just for rich text but......

#

Aaaaand I'm a dumbass, I actually just needed to use "/Subfolder/StyleAsset" and not "Subfolder/StyleAsset"

dusty pecan
#

I have an IDetailGroup to hold a bunch of widget rows. On each row I have .Visibility to hide the row from time to time. Sometimes all rows are hidden so I get an empty group. Is there a way to hide the group as well?

hasty coral
#

Hey anyone know how I can change the button style of a button to normal from code. Please 🙂

quaint zealot
#

Gonna need more explaining here

random solstice
hasty coral
quaint zealot
#

For Slate widgets that'd be the ButtonStyle() method on SButton

#

Usually you'd create a Slate styleset to manage your styles, create data assets to wrap Slate styles and then create these assets in the content browser

hasty coral
#

Is there any way I can set it from a UButton?

quaint zealot
#

UButton has SetStyle

#

Which takes the same parameter

hasty coral
#

Can you give an example because whenever I type Button->SetStyle(FButtonStyle::Normal); there is a red underline under the Normal

quaint zealot
#

Yeah, it's going to get a lot more complicated

#

What are you trying to do here ?

hasty coral
#

Basically I have an options button and whenever I press it, I set its visibility to hidden and change it to the options menu. Then when I click the back to main menu button, the options button stays is the pressed image state and doesnt work until i click + unclick

#

So I want it to not stay in the pressed state and go back to the normal state, so not stay pressed

quaint zealot
#

It should go back to the normal state immediately, I'm not sure what you did to make it not do that

#

In any case, changing the style will not achieve that

#

The style includes the normal, pressed, hovered states

#

What you're trying to do is reset the button state, which is not something that needs to happen

hasty coral
#

Idk but all I do when the button is pressed is set the visibility of the main menu to hidden and set visibility of options menu to visible...

quaint zealot
#

What's the reply on the OnClicked event ?

hasty coral
#

I binded it to OnPressed but do you mean the code?

quaint zealot
#

Why does it happen only the second time though ?

hasty coral
#

Because I hadnt pressed the button yet its always after I press the button, the visibility changes, then I go back

quaint zealot
#

I mean the first time you go in options and then back, it looks fine

hasty coral
#

Alright so I just changed the function to override OnClicked instead and it works perfectly fine now! But I would still prefer it would happen on onPressed

#

But i guess this will have to do for now

quaint zealot
#

Overriding OnPressed would work too, but you need to be sure to call the parent method

#

(and imho, buttons should never respond to presses, only clicks)

hasty coral
#

Ok thanks will try this now

solemn dust
#

Hey i got some problem with mouse click in umg, as far as i know, when you create override onmousebuttonup onmousebuttondown,
your left mouse button event from the player controller not firing anymore. Am I right ?
I want to change mouse cursor on click to different image and when i click on button or other element of ui which has implemented
onmouse logic, event from player controller not working. Anyone maybe know the way to do this?
I mean i could implement in every button click function changing cursor but it seems so awkward.

trim kestrel
#

Doubt I'm going to find the kind of expertise I need on this subject but...

#

Has anyone solved for altering the paint order of widgets in a typical container?

#

I'm afraid I'll have to make some kind of custom panel widget in order to make this kind of overlaying of an active tab above inactive tabs:

#

Where as in-engine I'm running into draw order issues. I need the active tab painted over inactive tabs.

#

And bollocks. SPanel has a PaintArrangedChildren, but it is non-virtual. -_-

quaint zealot
#

That's a tough one. I'd look at using SOverlay and override OnArrangeChildren

trim kestrel
#

Wait, I can possibly just move around the elements in OnArrangeChildren of an SHorizontalBox child class.

#

So they're in the draw order I want. It's kind a round about way but... maybe?

quaint zealot
#

I'm more wondering how you get overlapping widgets with a horizontal box at all, do these paint outside their alloted geometry ?

#

Thought you'd need SOverlay for that

trim kestrel
#

Negative padding, my dude. It is a wonder and a nightmare.

#

Negative padding everywhere.

quaint zealot
#

Alright

#

Then yeah, override OnArrangeChildren and you're good to go I guess

trim kestrel
#

I have a box with a horizontal padding of 10 on its contents, set to clip its content. Then that has an HBox with these buttons in it. All buttons have -10 horizontal padding. The inactive ones have a bottom padding of -12. They are also all bottom alligned.

#

That make sure that the box is sized, vertically, to fit the full active tab's height. The inactive tabs sink down by 12 units, but get clipped.

#

But since I can't control horizontal vs vertical clipping (that would be odd), I do the clipping on the exterior box, which has padded its content in by 10 units horizontally. That makes sure that if the active tab is leftmost or rightmost, it doesn't end up getting that little corner bit clipped off.

#

And the -10 horizontal padding on each button is how their vertical edges align, rather than having the tiny point at the end of the little corner bit be where they touch. And again, that's what necessitates the +10 counter padding on the hbox inside the box that clips. 🙂

mint ether
#

I have a widget that pops up when mouse cursor hovers over an object in game, but problem its set to on mouse cursor over and end for showing and hiding the widget and when the widget pops into view it cuts between the cursor and the object making the widget flicker on and off, how can I set widget not to block cursor?

toxic dove
quaint zealot
#

override OnArrangeChildren()

trim kestrel
toxic dove
#

ah the FArrangedChildren are in the order of their draw?

trim kestrel
#

SPanelWidget or some such has a PaintChildren function or some such, and it just goes in order of the children.

toxic dove
#

ok so it turns out to be the render order inadvertently

trim kestrel
#

Yep. (and 'allo, friend)

toxic dove
#

cool, i ran into this with Vertical/Horizontal panels and i was wondering what i could do

#

AYLO

trim kestrel
#

I did notice some weirdness though. I think there managed to be cases where the rendering gets out of order. Could be a bug on my side, not sure.

#

It generally seems to behave as intended though.

weary egret
#

I'm defining an action with the hotkey like so:

UI_COMMAND(OpenAction, "Open", "", EUserInterfaceActionType::Button, FInputGesture(EModifierKey::Control, EKeys::O));
#

but it doesn't look like that in itself listening for that hotkey bind.

#

Do I listen for it in Tick()?

#

the binding and executing are happening in a UWidget

weary maple
#

Any good tutorials for using slate online? I can't find any

quaint zealot
onyx cobalt
#

so i believe i changed something in project settings that lead to the appearance of the text "Something" down there and i cant remember. Can somebody help me with finding the setting?(or where is the text from)

#

sry if it isn't the right section to ask this

mild oracle
onyx cobalt
mild oracle
onyx cobalt
weary maple
#

How do I change the size of my text.

quaint zealot
#

In Slate, using a text style struct passed to the STextBlock

weary maple
#

I don’t know how to use text styles

quaint zealot
#

Depends on the context, for editor code you'd usually ask the editor style set for an existing style

weary maple
#

Can I make a slate widget style in unreal engine, and then use that in the code @quaint zealot

quaint zealot
#

I literally explained one way to do it

#

For game code you're looking at creating a Slate styleset and creating style asset (data assets / Blueprints basically) that contain Slate style structs as UPROPERTY

#

You can look up the Helium Rain source code that does it

weary maple
#

Ok thank you

weary maple
#

i am trying to display an image, but it is just showing a white box and I don't know how to fix it. this is my code.

FString PathToImage = FPaths::ProjectDir() + TEXT("Slate/Crosshair.png");
    GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, PathToImage);
    FName BrushName = FName(*PathToImage);

    return new FSlateImageBrush(BrushName, FVector2D(500, 500));```
quaint zealot
#

Is there a reason to do this in Slate ?

#

Linking images in Slate and having them packaged cleanly is a major pain

#

I mentioned the Helium Rain source for a reason

#

Use UMG for this

weary maple
#

do i use umg with c++ or is that in unreal engine @quaint zealot

toxic dove
#

you can use both, usually youd use slate for performance in a packaged game if your UMG widgets produce hundreds of UObjects

#

but that doesnt mean you would hardcode asset paths like that if you do use slate

paper hamlet
#

how do i assign a slate event to another slate event

    ChildSlot
    [
        SAssignNew(ListView, SListView<FGalleryAssetRow>)
            .ListItemsSource(&Blocks[0].SortedEntries)
            .OnGenerateRow(this, OnGenerateEntry);
    ];
typedef TSlateDelegates<FGalleryAssetRow>::FOnGenerateRow FOnGenerateEntry;
SLATE_EVENT(FOnGenerateEntry, OnGenerateEntry)
quaint zealot
#

Just pass OnGenerateEntry

#

Well, InArgs._OnGenerateEntry

paper hamlet
#

yeah i store it so it's just a pass ty

#

ok one more question

SAssignNew(ListView, SListView<FGalleryAssetRow>)
    .ListItemsSource(&Blocks[0].SortedEntries)
    .OnGenerateRow(OnGenerateEntry)

I created my list and I'm getting the following errors

#

do I need to reconfigure stuff to make my FGalleryAssetRows sharable?

daring laurel
#

Hi, ive post this on cpp, but maybe here more people has experience extending the editor. sorry4reposting:

Having a PC_SoftObject, what subcategoryObject should i use to serialize an array of FSoftObjectPaths? Or, PC_SoftObject is not the way to go?

I want a custom blueprint node to have a FSoftObjectPath as inputpin

weary maple
#

How do I use widget blueprint classes to display images, and access them in my c++ menuhud to add them to view port

chrome root
#

Whats the best way to render a dynamically generated image to screen (without using HUD, I mean inside a widget)

#

Trying to render audio waveforms

gritty frigate
#

Have you already generated the image? If not, then I’d create a new widget with OnPaint overridden. Otherwise just use SImage with your image

mortal echo
daring laurel
#

Wow great thanks @mortal echo , i will check it asap

chrome jasper
#

A little question

#

Can i make animations with slate?😂

#

I don't think it's possible but it can be, that's why I ask

plucky ore
chrome jasper
#

nice thanks

mild oracle
chrome jasper
#

Ok

daring laurel
#

How do i create an array in slate like we see it in detailsPanel

#

is there any helper or exposed class to create it? i cant find any class that uses a public CLASS_API

weary maple
#

I still can’t figure out how to display an image. I Made a slateimagebrush that has the path to the image and the size, but the image is just showing up white. It’s like it can’t get the image. Does anyone know why it would do this, or does anyone have a better way to do this?

quaint zealot
#

You need to set up a style set, a style asset, create a data asset for that styleset, and use that to store your images

#

As usual, for games, use UMG

weary maple
#

I have no idea what any of that means. I tried looking at helium rain and copied their code, and it just doesn't work. It shows a white image for me. People tell me use umg, i have no clue what that means. is that in blueprints or in c++. I just want a code example that i can use to guide me because i'm clueless. I stopped working on things for a week because i can't figure out this simple thing. There are no tutorials on youtube. There's like two stackoverflows and one answer is to look at documentation which i have tried and found nothing. And the other is unanswered. I will pay someone just to teach me how to get this working. It is something so simple in blueprints, but I can not get it working in code. If i could use display a blueprint widget in code that would be nice too, just anything. If anyone could dm me and help me get it working, I will pay.

quaint zealot
#

And yes, that's Blueprint

#

If you truly want to do your UI in C++ for some reason, then no, there are no tutorials, no resources, it's not a publicly supported engine feature

#

And as the guy from Helium Rain, that pipeline still works today - just need to work step by step and make sure everything works. Was the style asset found, is the brush set correctly, is the image correctly displayed if you pass nullptr to .Image(), etc

#

You're doing C++ so use the debugger

weary maple
#

how do i add blueprint ui widgets to gameviewport in c++

weary maple
#

@quaint zealot I am trying to do what it said in that link, but my game is now crashing instantly every time i run it. It crashes on the line when i add it to viewport. It's a nullptr exeption btw. this is my code.
Header file

TSubclassOf<UUserWidget> myWidgetClass;

UUserWidget* myWidget;```
Cpp file

myWidgetClass = LoadClass<UUserWidget>(nullptr, TEXT("/Game/Widgets/CrosshairReticle"));

myWidget = CreateWidget<UUserWidget>(GetWorld(), myWidgetClass);

myWidget->AddToViewport();

quaint zealot
#

Don't hardcode paths, use UPROPERTY

#

(And TSubclassOF<UUserWidget>)

#

If it crashes, use the debugger, something's nullptr

weary maple
#

i'm assuming it's not finding the widget. it's a widget blueprint class, is that okay?

quaint zealot
#

Yes, just use UPROPERTY instead of paths

weary maple
#

if i use UPROPERTY, i can't edit the widget class without changing it to a blueprint class. Do i change it to a blueprint class?

#

when i converted everything to Blueprint and used the UPROPERTY it worked fine.

quaint zealot
#

UPROPERTY is how you reference Blueprint stuff (actors, components, UI, resources) from C++

#

So yeah, both the UI widget class and the spawning class need to be Blueprint

#

You can then use C++ code for that spawner Blueprint to do whatever you want to do

weary maple
#

So i should make a bp subclass of my gamemode, playercontroller, hudclass, character and all of that stuff?

quaint zealot
#

Yeah, of course

weary maple
#

Alright, thanks so much, i've been struggling with this for a while

weary maple
#

@quaint zealot Is there a reason that the crosshair is showing up for the server player, but the clients are not seeing it even though im using the same character and hud for all

quaint zealot
#

Probably not done correctly in HUD class

weary maple
#

@quaint zealot Nevermind it was too skinny and wouldn't show up unless i full screened the clients, my bad

gritty frigate
#

This looks more like a #umg thing than a Slate thing

paper hamlet
#

ok so i'm not exactly sure what i did but for some reason adding something to childslot invalidates my Blocks Array

        TArray<FSortBlock*> Blocks = GenerateSortBlocks();

    TSharedPtr<SScrollBox> ScrollContainer;
    ChildSlot
        [
            SAssignNew(ScrollContainer, SScrollBox)
                .Orientation(EOrientation::Orient_Vertical)
    ];

after the first line I have an array with 1 block that has two entries

#

but immedately after I run the child slot line it gets invalidated. What on earth is going on?

toxic dove
#

if your scrollbox appears empty, use data breakpoints on its slots to see why they poof

toxic dove
#

it's the same thing except sometimes you may use an inlined SNew to cache into a TSharedRef directly

#

and then use that TSharedRef after that elsewhere

#

otherwise if you use SAssignNew youll have to convert to TSharedRef again on the next line

quaint zealot
#

Well you just need SAssignNew when assigning inside Slate syntax constructs

#

Like SNew(SBox)[SAssignNew(Var, Type)]

paper hamlet
#

ok thanks for the responses the issue was using struct pointers which were getting garbage collected but not overwritten until the SAssignNew()

paper hamlet
#

How do I go about creating a widget if i'm passed a UClass

TSharedPtr<SVerticalBox> ContentBox = SNew(SVerticalBox);
    for(FGalleryAssetRow Row : Block.SortedEntries) {
        ContentBox->AddSlot()[SNew(EntryWidgetClass)];
    }```
It's saying that it can't resolve `EntryWidgetClass`
chilly otter
#

How would I go about setting a default UTexture2D via cpp? (Pulling from an editor asset reference.)

quaint zealot
#

Rich text ?

#

The font needs to support it if you want it as raw text

ionic thunder
#

I am creating an FSlateIcon and I want to insert my own icons from the contents folder. How I can find the file location of the icon ?

FSlateIcon IconBrush = FSlateIcon(FEditorStyle::GetStyleSetName(), "LevelEditor.ViewOptions", "LevelEditor.ViewOptions.Small");
toxic dove
#

if you are asking where UE keeps the icon assets, you can look at the style class and find refs to it and inspect the code, they hardcode the paths

#

it is usually under Engine/Content/Slate/Icons

toxic dove
#

you need to look at RichText

toxic dove
#

RichText permits you to create decorators and insert images (such as emoji pics) in texts

#

ah ok, it is handled through the font asset i believe

#

i would use RichText so it works through all localizations though

#

(cuz font assets change depending on your game's language sometimes)

paper hamlet
toxic dove
#

list views take in entries, in this case they need you to make a class that derives from IUserObjectListEntry

#

in the case of UListView they must take in an array of UObject

#

and then your class that derives from IUserObjectListEntry (which is also a widget class) will be used to display said UObject

#

that means you need to make a UObject wrapper for your UListView things you wanna show

#

but this is actually #umg now

#

slate's ListView is very easy, its just a TArray<TSharedPtr<Something>> and there are callbacks you need to set to draw your widgets

#

i think you are mixing UMG with Slate

chilly otter
bold forge
#

I'm trying to see if it's possible to use vertex colors for materials in UMG and as far as I can tell Slate is always going to use vertex colors for tinting UI elements. As vertex colors get applied in the element batcher and I'm not even sure where they are eventually applied as a tint it feels like there's just too much of the pipeline that would need to be overridden to make this work, if it's even possible at all? Is this something anyone has experience with or should I just give up on it?

mild oracle
bold forge
# mild oracle Yeah as you said it doesn't sound worth it. You would only have 4 vertices too w...

Potentially, although I may want the UVs to look up images in a texture atlas. Right now I'm evaluating the viability of SDF rendering for UI, something that we did for most of the UI on my last project (in Unity). It would be really useful to be able to push any kind of data into the materials without having to create dynamic instances for everything in UI. 4 vertices all pushing the same colour would give 4 channels of float data. Maybe those material instances are not so big of a deal though?

mild oracle
#

I can see how being able to push info would be useful! I usually just use material instances but our project is only targeting desktop

bold forge
#

Ah yeah, I had seen her recent post about that actually, although it seems she's just using material instances there. I might dig around a bit more but probably it's not worth pursuing

toxic dove
#

heres her examples, its pretty cool

rocky abyss
#

Lol awkwardly walks away

paper hamlet
#

@toxic dove sorry to ping you. On creating my own kind of list. I've been investigating SObjectWidget. When I create the SWidget I take a UDataTable to get my item list from. Could I just itereate over that and fire an event in the following pattern

SWIDGET has a slate event OnGenerateEntry(Entry, TSharedPtr<SObjectWidget> OutWidget) that broadcasts
UWIDGET listens for the event and creates an SObjectWidget from the EntryWidgetClass
UWIDGET fires an event to BP with the Entry and the UWidget gotten from the SObjectWidget

am I missing anything or is that the general pattern

toxic dove
#

the UWidget gotten from the SObjectWidget

#

how do you get a UWidget from a slate class

#

are you sure you dont mean your UMG wrapper that spits out the slate widget?

paper hamlet
#

SObjectWidget is a GCObject that's created from a UUserWidget

#

it's specifically created for going back to a UWidget or at least that's how I'm reading it

#
/**
 * The SObjectWidget allows UMG to insert an SWidget into the hierarchy that manages the lifetime of the
 * UMG UWidget that created it.  Once the SObjectWidget is destroyed it frees the reference it holds to
 * The UWidget allowing it to be garbage collected.  It also forwards the slate events to the UUserWidget
 * so that it can forward them to listeners.
 */```
#

or are you saying fire the event from the UWidget to BP first and then use the pointer from the UUserWidget to create the slate widget?

toxic dove
#

i dont really understand what youre trying to do, are you trying to make a Slate ListView using a UWidget class?

paper hamlet
#

kind of i'm trying to make my own version of a list that pulls from a data table. Preferably I would like to be able to set a UUserWidgetClass for each of the entries to generate so that it's not hard coded.

#

the problem is that UDataTable uses UStructs instead of UClasses so i'm trying to figure out how to

  1. Get the bp widget down to slate so I can actually draw it
  2. Get the data from slate to bp to configure the widget class
toxic dove
#

thats fine but i think youre going about it the wrong way

#

make a UMG object which has a reference to your data table

#

make your slate widget for this new UMG class that takes in the DT as a mandatory arg

#

in your new UMG object, it should really only be 2 things :

  • the UPROP to the DT
  • a RebuildWidget function which returns your slate widget (this is where youll build your slate widget)
#

and then all your logic and drawing and all that is in your slate widget class

#

however at this point if youre creating a UMG widget for the list view entries, then at this point it's not slate anymore, you should just create your own UMG widget class completely (by mimicking UListView)

toxic dove
#

or

#

make a UObject wrapper for your ListView entries that also takes in the custom entry widget class

#

that would probably be much simpler and skips reinventing the wheel

calm zealot
#

Hi guys, I am new to unreal so i apologize if this is the wrong section. I am doing some 101 make a game tutorials and have a general question about UI design workflow

#

is there a way I can view all of the UI elements in my game in realtime on the viewport, so that as I adjust positions of UI elements, even if they are in different Widgets, I can see how the final display will loook?

#

what i aim to do is not have to adjust my UI elements "blindly" without respect for the actual scene view

quaint zealot
#

UMG kind of does that

#

Assuming you put them all in one master HUD widget

calm zealot
#

thanks @quaint zealot . tutorial i am following is breaking HUD elements into lots of different widgets, i think just for the sake of showing different methods, but yeah I think it would make sense to keep it all in one widget because certainly we can still access elements within the HUD as we need

obsidian gust
#

hello, could anyone help guide me on how to pass an event / delegate into a button, so that when it's clicked it calls a function in the parent widget?

#

been trying to work with SLATE_EVENT and BindSP stuff, but the internet is pretty lax on how these things work

toxic dove
#

declare a SLATE_EVENT as such
SLATE_EVENT(FSimpleDelegate, OnPushMyBouton)

in the Construct where you make your SButton

.OnButtonReleased(InArgs._OnPushMyBouton```
#

when you create this widget, you pass in the delegate like

.OnPushMyBouton(blah)```
#

you can look at the engine slate widgets, they do the exact same thing

#

there are tons of engine examples

obsidian gust
#

thank you!

winged fern
#

Can I use virtual texture with slate? For example, world map.

prime escarp
#

i have a little bit of an issue here, Im programming slate ui in c++ and i can get the game paused, however when im focused in ui, the binding i have set in my playercontroller (esc) to return to the game doesnt work. Only OnKeyDown overriden UWidget function works for me, but i dont know how to make it listen just to the binding i have set in my project settings

#
{
    GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, TEXT("OBAMA"));

    return FReply::Handled();
}
quaint zealot
#

Slate UI doesn't respond to bindings at all

#

So in this case you need to get the bindings for the action you're looking for, and test if InKeyEvent matches one of them

prime escarp
#

Isnt it possible to controll the slate ui from outside class tho? From the playercontroller itself? This is the only option?

quaint zealot
#

When showing Slate UI with mouse cursor, all game input is suspended

prime escarp
#

well thanks for the answer 👍

spiral meadow
#

anyone knows some good tutorials or example projects for slate beside the ShooterGame?

warm vault
#

UT

mild oracle
ionic thunder
#

I've created a new custom button in the toolbar on top of the editor window. To set my icon do I need to create a new FSlateStyle or there is an easier way ?

Currently what I do is setting the icon through this line, but I am using one of the defaults icon in the editor. If I add my own path from content, the icon is not loaded correctly.

FSlateIcon IconBrush = FSlateIcon(FEditorStyle::GetStyleSetName(), "LevelEditor.ViewOptions", "LevelEditor.ViewOptions.Small");

that is used as input to

builder.AddToolBarButton
(
  FSpecEditorCommands::Get().SpecToolBarBtn,
  NAME_None,
  FText::FromString("Spec Editor"), 
  FText::FromString("Click to open Window"),
  IconBrush,
  NAME_None
 );
viscid beacon
mild oracle
viscid beacon
gritty frigate
#

It looks old, as it refers to UMG as an upcoming feature

#

I’m going to guess 2014/2015 because the author was working on “tools” between December 2013 and April 2015, according to IMDb. They were “platform” before that, and doing Sequencer after that

mental sky
#

Is it even possible to use BPs for assigning Icons via SlateStyle or are CPP declared classes the only ones that work?

mild oracle
#

Can anyone explain what the limitations are of SMeshWidget? I swear I read somewhere that it can't render certain stuff

narrow terrace
#

It should be able to render just about anything, but it requires a good knowledge of graphics coding...

mild oracle
#

I'm looking at it now, it has its own unique USlateVectorArtData data struct and FSlateMeshVertex vertex info. So I guess I have to write something that takes a standard mesh and tries to do something sensible to convert it to this kind of info?
Seems odd that nobody has done that yet

craggy holly
#

There used to be a factory class for it, but for some reason it's missing from newer engine versions.

fiery onyx
#

I'm trying to make a textblock constantly fade in and out slowly in Slate, but it doesn't show up in game the way I want to. I might have gotten the formula wrong here, but anyway, in-game it appears as if the tick only happens once every second or so.

void SLoadingCompleteText::Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime)
{
    if (GetVisibility() != EVisibility::Visible) return;

    const float Hz = PI * 2.0f;

    CompleteTextColor.A = (FMath::Sin(InCurrentTime * Hz) + 1) * 0.5f;
}
fiery onyx
#

Thought I had solved it when I found out about Active Timers, but even when registering an ActiveTimer with 0 TickPeriod, it still only refreshes every second or so

fallow moss
#

anyone have an idea what to look for to fix this?

#

i modified the editors slate layout to put the window buttons on the left, apparently the tabs overlay the buttons on small windows but it's only noticable in the left hand layout

grim radish
#

Hey guys, Im trying to bind a UWidgetAnimation with the BindWidget but it does not pick the animation from the animations tab list. Do I have to add the animation somewhere else? I thought they were supported

grim radish
river harness
#

Hello guys, I have a UMG wrapper for my Slate widget and I need to pass some UObjects from UMG to Slate, but these objects get garbage collected even if the widget is still active. I initially used TWeakObjectPtr to prevent crashes, but with these invalid objects the code doesn't work properly. What's the best way to handle this?

craggy holly
#

You can use TStrongObjectPtr to store their references, or make the Slate widget inherit FGCObject and add the UObject to the referenced objects list.

#

TStrongObjectPtr is itself an implementation of FGCObject

gritty frigate
#

Take a look at SObjectWidget - this is the Slate class that is returned when you call TakeWidget() on a UUserWidget, so is a Slate object that wraps a UObject

river harness
#

@craggy holly @gritty frigate thank you guys!

gritty frigate
#

If you have a UObject, referencing a Slate object, which is then referencing a UObject, be careful about how things are destroyed

#

If SObjectWidget is destroyed while in GC, it'll flag an error. If you have a TSharedPtr<SWidget> in a UObject, make sure you nullify it before GC starts

#

This would be in ReleaseSlateResources, I believe

river harness
#

@gritty frigate ok, I'll do that, thank you for the help!

ashen sedge
#

Not really sure where to ask this and google didnt help but does anyone have any idea what the default font for unreal is? Especially curious about blueprints but I'd imagine it'd be the same

quaint zealot
#

Dunno about Blueprint editor but Slate only uses that out of the box AFAIK

ashen sedge
#

Awesome, thank you so much, really appreciate it!

tired harness
#

Is there any documentation on how one would go about adding a new window in the editor using slate?
I am trying to create an additional window to the asset ToolTip that appears when hovering over something in the ContentBrowser.

#

I am utterly confused as to how to work with slate to draw a simple window

mild oracle
#

@tired harness I would check out the Test Suite under Developer Tools > Debug Tools. It's got a lot of examples for creating windows.
You can use the Widget Inspector to mouse over something that looks promising, find the name of the class, and then find how it's created in the Test Suite by searching the engine code for that name. Sometimes you can just search the engine code for the exact string that's used in a button in the Test Suite and find it.
https://twitter.com/_benui/status/1380582233577168896

How did I only just learn about #UE4's Slate Test Suite?

It's full of super useful examples of what's possible, what things are called. You can use the Widget Reflector on anything to easily go to the code.

tired harness
tired harness
#

Well I already have the widget reflector info from exactly what I want, but I might as well be looking at hieroglyphs 😅

#

The slate layout stuff is confusing but I can at least understand it somewhat. What I don't understand is how to actually draw anything in the context of the editor

tired harness
#

the plugin examples I have found use for example a FGlobalTabManager::Get()->RegisterNomadTabSpawner() to create a dockable window
Or FMessageDialog::Open()
So I am guessing there is some magic struct that has what is needed to simply draw a SWindow?

#

actually the FGlobalTabManager::Get()->RegisterNomadTabSpawner is wrong as well. I have no idea what actually creates that window, im just commenting things out at random to see what happens shrugs

mild oracle
#

@tired harness How much Slate have you written? I would start with something really simple like making a Slate Widget, and showing it via UMG. Then moving onto Editor customization

tired harness
#

I have written 👌 (0) slate.
Only reason I would even be interested in it would be for editor customization, I find it way too verbose already to do any game coding in it without going insane

mild oracle
#

@tired harness It is a pain in the butt, I couldn't learn it until I took a step back and learned how to do some basic Slate stuff. Then looking at the existing editor examples made sense.

tired harness
#

Well, I will hit my head against this for the rest of the week and see how it looks then, if I still got nothing I guess I will make some basic slate stuff in a game I suppose there are atleast "some" references for that online already

quaint zealot
stone goblet
#

What are the pros and cons of Slate and blueprint editor tools, apart from slat being in C++, and have more expose to the engine code?

quaint zealot
#

Slate is meant for editor tools, UMG for games

#

Slate needs a lot of boilerplate to be usable in games

mild oracle
viscid beacon
#

My current goal is the following.
To create a Rich Text with embedded Icons. (Decorator class replaces CSS-like tags with Images)

An Icon is an image that must:
[] Have three different brushes for Unselected, Selected, and Clicked.
[
] Have a Tooltip widget.
[*] Open a new Widget when clicked (with either a cursor or gamepad/keyboard)

So far, I have managed to embed a custom Slate Widget class (SWidget) inside a RichTextBlock through a custom Decorator class (Based off of RichTextBlockImageDecorator).
I also managed to give them tooltip widgets.

To achieve the last item. Opening a new Widget via Gamepad / Keyboard. I need to access the SlateWidget embeded inside my rich text.
My idea is to extend URichTextBlock so that I can pass in a TArray< TSharedRef< SWidget > > by reference and have my custom SWidget class emplace the newly created "Icons" into the TArray upon their creation.

Why do I need to grab pointers to these Icon widgets? So that I can write the UI "State" code. I plan to navigate through the user interface using integer indices and TArrays of widgets. (e.g. Text Entry #45 is selected, Icon #2 is selected ==>> EntryIndex = 44, IconIndex= 1 )

My intention is to access the widgets embedded into my rich text from my game code, I plan to attempt this for at least a week.
I'm already struggling though.

viscid beacon
#

For the time being I need to learn how to pass additional parameters to the SWidget::Construct method instead of just appending more data members to the one FArguments struct parameter. Otherwise I'll never be able to pass a container by reference.

EDIT: Turns out I can just declare a construct method with any signature I want. Making some steady progress Rubber ducky squeaks

gritty frigate
#

Construct is generally called from within SNew or SAssignNew. How are you calling it manually?

viscid beacon
#

At the moment, I still have not managed to call the parent's construct method from inside the child. I have not gotten to the SNew() statement just yet.

#

Turns out FArguments is always qualified under a SWidget class. Still not sure what I need to do.

#

I'm slowly coming to the horrifying realization that I am going to need to literally duplicate all of the code of SRichTextBlock and URichTextBlock instead of just being able to extend these clases.

#

All thanks to how FArguments works.
I'm going to take a nice sanity nap.

quaint zealot
#

I'm wondering why this is difficult - clickable URIs in text are a thing

#

Did you look at how those worked ?

viscid beacon
quaint zealot
#

Well, assuming you use the built-in navigation system it might be quite easy

viscid beacon
#

I don't really understand the built-in focus system. It does not seem to allow nested/layers selection. It just tries to make the best guess of which widgetto jump to next right?

quaint zealot
#

I think it might, since widgets have a concept of navigation exiting a widget

#

Not that I have used it myself

viscid beacon
#

Hmm. I'll read a little more on widget navigation then. Thanks for the tip.

quaint zealot
#

From EUINavigationRule

#

Now on to this

call the parent's construct method from inside the child

#

This is my custom button class :

SButton::Construct(SButton::FArguments()
.ButtonStyle(FXxxStyleSet::GetStyle(), "Xxx.Button")
.ButtonColorAndOpacity(FLinearColor(0, 0, 0, 0))
.ContentPadding(0)
.OnClicked(this, &SXxxButton::OnButtonClicked));
#

(This is in SxxxButton::Construct)

viscid beacon
#

I just remembered why I can't use UMG navigation.

#

I'm trying to "navigate" through Slate Widgets. you can only embed Slate Widgets inside RichTextBlocks. Meaning that the UMG navigation cannot navigate to the embedded widgets.

quaint zealot
#

Pretty sure UMG just uses Slate's nav

#

UMG is a very thin layer of UObjects for the Slate widgets

viscid beacon
long canyon
#

Hey guys, I'm planning to have some world space markers rendered in screen space. I want to have them rendered in order of greatest distance from the camera. I'm looking at the overlay widget to render these markers. I'm assuming that just updating the FOverlaySlot ZOrder for each marker will be sufficient yeah?

viscid beacon
#

If there is a way to remap the input that fires the FNavigationEvent, I have not been able to find it.
I will need to be able to remap these inputs if I want to use Slate's built in navigation system. (which is limited to arrows + tab, I can't find any Navigation Event equivalent to a face button e.g. A, X ).

tired harness
stone goblet
#

Where to learn slate, for editor tools?

quaint zealot
#

@stone goblet The engine source mostly

stone goblet
tired harness
#

isn't using SWindow->SetVisibility(EVisibility::Hidden)
also supposed to hide what is in the window?

#

nvm, I'm supposed to use Hide/ShowWindow() for SWindow

paper hamlet
#

ok so i'm taking another crack at creating a UWidget that allows me to add a UUserWidget subclass that gets used to generate a gallery. i'm taking another look through the API and I think I have identified the following pattern mainly from looking at how the lists are constructed

  1. Create an UWidget with the property TSubclassOf<UUserWidget>
  2. Create a SWidget that has a slate event OnGenerateEntry that expects a return value of TSharedPtr<SWidget>
  3. In the UWidget::RebuildWidget bind OnGenerateEntry to a function that Looks at the subclass and generates a SObjectWidget from it (i've noticed that the panel widgets just use TakeWidget. How do I choose which method I want to use)

Is that at least somewhat close to what others have experiences as the proccess?

#

i'm aware it's very high level and doesn't include thinks like pools and handling scrolling into view to optimize it but I just want it to work first and optimize it later

toxic dove
#

what do you expect your UWidget to return as an SObjectWidget ? its inner slate widget? just call that widget's RebuildWidget function

#

as in

{
    Create Subclass UWidget
    return SubClassUWidget->RebuildWidget();
}```
#

the only problem there is that to create your nested UWidget instance you need a valid UWorld , not sure if its available during design time

paper hamlet
#

hmm alright i'm not seeing where the list view gets that from

#

how i'm seeing generation be done is the following
UListViewBase::ConstructListView() constructs the list view and Fires OnGenerateRow which is bound to UListViewBase::HandleGenerateRow()
UListViewBase::HandleGenerateRow() constructs a UUserWidget from the EntryWidgetClass with UListViewBase::OnGenerateEntryWidgetInternal()
UListViewBase::HandleGenerateRow() converts the UUserWidget to TSharedPtr<SWidget> with EntryWidget.GetCachedWidget()
UListViewBase::HandleGenerateRow() returns StaticCastSharedPtr<SObjectTableRow<ItemType>>(CachedWidget).ToSharedRef();

#

i looks like UWidget::GetWorld() is also already defined

paper hamlet
#

actually another point. if i'm only ever going to be adding the gallery to the viewport during runtime I can just do it all in the widget. there isn't a reason to make an swidget at all right?

fervent acorn
#

is there a text box of some kind that windows can interact with at runtime? ios and android can hook the OS keyboard to text box elements, can the same be done with windows?\

amber bison
#

How exactly do custom widget styles "connect" with something like a DetailsView? I might not be using the right lingo so forgive me - never touched slate before.

As an example, let's say you want to create a custom style to increase the width of this textblock.

#

I assume it starts here under the InCustomRow conditional - is this correct?

dusty pecan
#

I use IDetailChildrenBuilder::AddExternalObjectProperty to add a bunch of properties of a behind-the-scenes object to the Details Panel of my Component. There are multiple instances of the behind-the-scenes object and I have a combo box to switch between them. Is it possible to replace the object that the the widgets created by AddExternalObjectProperty bind to? I'm not finding anything in https://docs.unrealengine.com/4.26/en-US/API/Editor/PropertyEditor/IPropertyHandle/, I had expected there to be a SetObjects or similar.

dusty pecan
amber bison
# dusty pecan I'm new to Slate too, but I think sizing is controlled either by the widget itse...

Thanks for the reply - I was just using sizing as an example. I’m just stuck on trying to figure out how to “inject”, for lack of a better term, or override the widget that gets used.

i.e. instead of the editor creating SSpinBox<NumericType>, I want it to create SMyCustomSpinbox<NumericType> if that makes sense. Like how does a UPROPERTY from a class use a custom style that’s created in another class I guess is the question.

dusty pecan
# amber bison Thanks for the reply - I was just using sizing as an example. I’m just stuck on ...

I might not fully understand, I know nothing about styles, but with a Detail Customization you can add the UPROPERTY explicitly with IDetailCategoryBuilder::AddProperty which will give you a IDetailPropertyRow back. On that you can use CustomWidget along with NameContent and ValueContent to inject whatever widget you want.

IDetailProeprtyRow::GetDefaultWidgets can also be useful if you only want to replace parts of the row.

Never tried it myself so this is mostly speculation based on reading I've done trying to figure Slate out myself.

https://ikrima.dev/ue4guide/editor-extensions/detail-customization/detail-customization-examples/
https://docs.unrealengine.com/4.26/en-US/API/Editor/PropertyEditor/IDetailCategoryBuilder/AddProperty/1/
https://docs.unrealengine.com/4.26/en-US/API/Editor/PropertyEditor/IDetailPropertyRow/

Adds a property, shown in the default way to the category

A single row for a property in a details panel

thin mauve
#

Is there a way to extend from FSlateApplication or create your own one, and hook it up into unreal's LaunchEngineLoop.cpp

craggy holly
#

Don't think so

#

Would have to make engine changes

ivory tiger
#

how to add USizeBox as slate?

craggy holly
#

Just SBox in slate I think

amber bison
#

is there a way to listen for changes to a property within a struct of a class? Currently anytime the array is changed in the example below, the delegate runs but I'm just looking to target Bar within StructA

Is this possible to do? If Foo has 4 items in the array and Foo[2].Bar changes, is there a way to detect which index changed?

toxic dove
#

yes

#

get the property handle of your Bar property

#

you can iterate across the ArrayHandle and get all the child property handles and bind to them individually, and the ArrayHandle also has a delegate when the array itself is edited

#

note that you'll have to strongly cache all the child property handles when you bind to them

#

you can use a lambda if you'd like as well to send in the array index with the FSimpleDelegate as that alone will not give you the right index

#

first get your Foo property handle and use AsArray

#

it will return the ArrayHandle which you can then use to

  • bind to when its elements change (add/remove)
  • iterate across its child properties (array elements) and bind to each of them changing (dont forget to cache the child proprety handles)
#

when the array changes, make sure to re-bind to the new elements, etc.

restive sapphire
#

When you create a custom menu item (content browser), how do you create a blueprint class that derives from the C++ class? Is there a custom Factory type that needs to be used instead of UFactory? I tried UBlueprintFactory but it fails. Please excuse my ignorance as I'm very new to Slate and C++

toxic dove
#

a factory is used to create assets

#

what you want to do is create a BP class of a native C++ class. all you have to do is define the C++ class in your code and expose it to BP (UCLASS(Blueprintable))

#

and then "Create BP" button in editor and youll see your C++ class in the list (or you can search for it)

#

factories are used to create actual assets, which are not BP CLASSES they are ASSETS, like a texture, or a data asset, or a data table, etc.

#

an easy explanation is this : would you create a BP class... to make a texture? no. a texture is a texture.

dusty pecan
restive sapphire
toxic dove
#

if theyre using a factory, theyre creating assets and not classes. i would need more information about what youre trying to replicate

restive sapphire
#

GA_Test is a blueprint class.

#

Just trying to do something similar to this here.

#

I'm looking into it now. I have it setup the same exact way they have it setup except when the asset gets created, it always gets created as an asset and not a blueprint type (like you mentioned). I think I'm missing a little bit of magic.

toxic dove
#

oh cool i didnt know this type of factory existed

#

uhm what i would do is search the entire project for any mention of this GAS factory

#

and just make sure im doing it exactly like they are

#

from what i see, this Blueprint factory uses the exact same code that would be used when you create BP classes manually (without a factory)

true night
#

asked in UMG as well, but figured it might be relevant to the slate channel too 🙂

Anyone know if I can swap decorators at runtime for rich text? If a player swaps between Mouse/KB and controller, I'd like to swap the image decorators to a different icon set. that way I can just call <img id='jump'> in rich text instead of <img id='xbox.jump'> or something

short vale
#

Anyone know of a good tutorial for displaying an .Image in (SImage)

quaint zealot
#

Need to set up your style set, start it up in your game module, and then you can either create style assets & create / fill them with your brushes in content browser, or get Slate brush assets from the styleset directly

short vale
#

ty

short vale
#

so my style set is setup with my game module, now i have added an FBrush

SNew(SImage)
.Image(&GlobalStyle->BackgroundBrush)

and the picture is completely white

any ideas?

quaint zealot
prisma lark
#

Hi everyone! Maybe someone knows how can I update opened windows in editor when i changed asset CDO. For example: I changed ans save DataTable asset in my custom widget and in the same time this asset open in default datatable editor. But editor window contains old value. If i reopen window he show new value. So question is may i somehow notify this window about asset changes or try refresh this window on the fly? I'm using C++ with Slate.

short vale
# quaint zealot How did you get GlobalStyle and how did you fill it with brushes ?

const FName FGlobalStyle::TypeName(TEXT("FGlobalStyle"));

GlobalWidgetStyle.h

    UPROPERTY(EditAnywhere, Category = Appearance)
    FSlateBrush BackgroundBrush;
};

GlobalWidgetStyle.cpp

const FGlobalStyle& FGlobalStyle::GetDefault()
{
    static FGlobalStyle Default;
    return Default;
}

void FGlobalStyle::GetResources(TArray<const FSlateBrush*>& OutBrushes) const
{
    // Add any brush resources here so that Slate can correctly atlas and reference them
    OutBrushes.Add(&BackgroundBrush);
}
quaint zealot
#

How do you expect this to work ?

#

How can you edit BackgroundBrush in the editor to set a brush to it ?

short vale
#

i see, legend

quaint zealot
#

You need a Blueprintable style asset holding that FGlobalStyle

#

Then create an instance of it in the content browser, fill it with your resources

#

Get it in code

#

And then you can use the image

dusty pecan
#

The default slate widgets for numbers doesn't handle very small and very large (infinity even) numbers well. Are there ways to handle this? Any widget that switches to scientific notation when needed?

gritty frigate
#

You'd probably have to build your own. It's not massively tricky to use an SEditableText widget to make a numeric control widget

dusty pecan
#

I kind of expected that, so I have some thoughts already. I'm most worried about the spin/slider functionality available on the regular widgets, but I might just skip that for now.

quaint zealot
#

Check out what the editor uses for FVector vizualisation, since that's got scientific notation

gritty frigate
#

useful

dusty pecan
quaint zealot
#

Ah, nevermind

#

Thought it did that

dusty pecan
#

How do I configure a Details Panel widget that is in a subcategory?

My usual approach is to get a reference to the category (DetailBuilder.EditCategory) and handle to the property (DetailBuilder.GetProperty), and re-add the property which gives me an IDetailPropertyRow that I can e.g., set visibility on. With a subcategory, using UPROPERTY(Category="Top|Sub"), the widget gets moved to a new top-level category named "Top|Sub", which is not what I want.

short vale
dreamy yoke
#

I'm running into some warnings and I would like to resolve them, though I'm not having any luck finding any docs on this. How do I resolve the following errors?

[2021.07.03-00.46.34:695][  0]LogSlateStyle: Warning: Missing Resource from 'CoreStyle' Style: 'Unable to find SlateColor 'AnimGraph.Attribute.Pose.Color'.'
[2021.07.03-00.46.34:698][  0]LogSlateStyle: Warning: Missing Resource from 'CoreStyle' Style: 'Unable to find SlateColor 'AnimGraph.Attribute.Curves.Color'.'
[2021.07.03-00.46.34:699][  0]LogSlateStyle: Warning: Missing Resource from 'CoreStyle' Style: 'Unable to find Brush 'AnimGraph.Attribute.Curves.Icon'.'
[2021.07.03-00.46.34:699][  0]LogSlateStyle: Warning: Missing Resource from 'CoreStyle' Style: 'Unable to find SlateColor 'AnimGraph.Attribute.Attributes.Color'.'
[2021.07.03-00.46.34:700][  0]LogSlateStyle: Warning: Missing Resource from 'CoreStyle' Style: 'Unable to find Brush 'AnimGraph.Attribute.Attributes.Icon'.'
[2021.07.03-00.46.34:700][  0]LogSlateStyle: Warning: Missing Resource from 'CoreStyle' Style: 'Unable to find SlateColor 'AnimGraph.Attribute.Sync.Color'.'
[2021.07.03-00.46.34:701][  0]LogSlateStyle: Warning: Missing Resource from 'CoreStyle' Style: 'Unable to find Brush 'AnimGraph.Attribute.Sync.Icon'.'
[2021.07.03-00.46.34:701][  0]LogSlateStyle: Warning: Missing Resource from 'CoreStyle' Style: 'Unable to find SlateColor 'AnimGraph.Attribute.InertialBlending.Color'.'
[2021.07.03-00.46.34:702][  0]LogSlateStyle: Warning: Missing Resource from 'CoreStyle' Style: 'Unable to find Brush 'AnimGraph.Attribute.InertialBlending.Icon'.'
valid field
#

Anyone has used SColorWheel? I've added it to my UWidget and it shows up. Clicking on it however doesn't update the Selector location, it is just stuck in the middle. (Actual selected color does change when listening to OnValueChanged)

toxic dove
#

look at FTabManager

#

here is my example

#

it creates 3 tabs

#

im sure you can find examples in the engine code

bold forge
#

I have a weird Slate bug where my Widget seems fails to capture the Mouse on the very first mouse button down event. Subsequent events work correctly. What appears to be happening is that as soon as I send back my FReply, I am getting mouse capture, then something else is immediately grabbing that capture away. I would have thought that by handling the event and capturing the mouse then that would prevent anything else from receiving the event?

{
    FReply reply = FReply::Unhandled();
    if(IsEnabled())
    {
        MaybePress(mouseEvent.GetEffectingButton()); //Just sets internals
        reply = FReply::Handled().CaptureMouse(AsShared());
    }
    Invalidate(EInvalidateWidgetReason::Layout);
    return reply;
}```
bold forge
#

OK, it looks as though this is because my widget doesn't support keyboard focus and so Slate tries to set focus to something, and that something is grabbing the mouse capture, which seems bizarre to me. Should it not be possible to have a UI element that only receives clicks and not keyboard focus?

bold forge
#

Investigating further this also happens with the built-in Button widget if you set it to non-focussable, so it's not a problem with my code. It's reasonable to assume that "Widgets ignore their first click if not focusable" is a reportable bug in Slate?

split laurel
#

What widget receives the mouse button down event if not yours? The next one up the hierarchy that handles it?

bold forge
#

Actually very unclear. When I was debugging it I ended up with a TWeakObjectPtr<SWidget> and the debugger was not showing my any obviously identifying information. I don't have any focussable widgets spawned in my test, and I've also has some weirdness if I click off the PIE screen and back onto it, so I think it might actually be part of the Editor UI

split laurel
#

Hmm hard to say without looking into it further. I'd say, if you want to fix it and submit a pr, go ahead. I can eventually take a look and merge it in or recreate your fix, as long as it passes review

bold forge
#

Heh, I think it would probably be several days work minimum for me to understand the inner workings of Slate well enough to even consider making changes 🙂 I can put together a barebones project that reproduces the issue and submit a bug report though

craggy holly
#

I wonder if it's the viewport maybe, the viewport or even an editor-only widget that has focus

craggy holly
#

😄

bold forge
#

Thanks - turning that off seems to fix everything for me

craggy holly
#

Ah awesome good to know. I don't know if there's a reason it's focused by default, but I have a feeling you may not get "normal" game input as the viewport is eventually what passes it down to the game

gritty frigate
#

Does anyone know how I can show a tooltip immediate on calling SetToolTip? Or if there's another way of showing some floating text next to the mouse?

mild oracle
#

Did someone here say it's possible to subclass/replace FSlateApplication? So Unreal uses your own custom one, without having to make a custom version of the engine?

gritty frigate
#

I'm pretty sure someone said that it wasn't possible

mild oracle
#

darn

gritty frigate
amber bison
#

Is there a way to register a custom property layout for a property that is a TSubclassOf<MyCustomClass>?

PropertyEditorModule.RegisterCustomPropertyTypeLayout("??", FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FCustomPropertyDetails::MakeInstance));```
#

the property is inside of a struct, so for exmaple:

USTRUCT(BlueprintType)
struct FCustomStruct {
    GENERATED_BODY()

    UPROPERTY(BlueprintReadWrite, EditAnywhere)
    TSubclassOf<UFoo> FooProperty;

    UPROPERTY(BlueprintReadWrite, EditAnywhere)
    FBar BarProperty;
};

// This works for Bar since the property type is FBar
PropertyEditorModule.RegisterCustomPropertyTypeLayout("Bar", FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FCustomPropertyDetails::MakeInstance));

// Not sure what the "type" to register would be for FooProperty
PropertyEditorModule.RegisterCustomPropertyTypeLayout("??", FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FCustomPropertyDetails::MakeInstance));
elder ginkgo
#

You'd have to do weird shit

#

Get current registration for tsubclass, check for it's templated type and override if it's yours

#

Get current registration before registering your own so you can inject it

bold forge
#

Where is the best place on here to ask technical input-related questions?

craggy holly
#

Ah the button presses are probably lost because the UI is "consuming" the press events but not double-taps or releases.

#

Probably either here or #cpp I would say

#

I've not got a huge amount of knowledge on it, but I know that Slate is where all input from the platform initially goes, then it gets routed depending on the input mode of the player, which is GameOnly, GameAndUI or UIOnly. The UI-based modes always put input through slate first, and if slate "consumes" or "handles" that input, it never gets as far as the viewport client. The Viewport Client is what eventually pushes it down to the players "game" input stack.

bold forge
#

Gotcha. I really don't think that slate is consuming the input, it's just refusing to pass some of it down to the viewport (which could be that the viewport widget is consuming it I guess). Updating my settings to the following seems to have fixed both error cases, but I have no idea why!

#

There's probably some additional bugs introduced my this, because it still doesn't seem right, but hopefully I'll get there eventually

craggy holly
#

Yeah something must be "handling" it or maybe consuming that initial click.. capturing on launch I think would fix that need to double-click initially! Maybe the act of setting the focus consumes that click somewhere

#

Actually that could be it.. when you set focus the widget either returns "handled" or "unhandled" replies, I think the default is handled to avoid focusing and clicking something at the same time maybe

bold forge
#

I think the initial issue I had, where UI breaks on the very first click, is related to the act of capturing - the viewport steals it from the UI, so you get inconsistent results on that very first click - I didn't check but I actually think that might be a PIE thing only. The issue I had today I think is actually the system working as expected, because my workaround was bad

#

I don't think it's related to handled, as most of the UI seems to not care about (handle) clicks from most of the mouse buttons - the whole reason why I'm messing with Slate in the first place is to block right clicks while hovering over UI

tired valley
#

hey im trying to do custom tooltip text and I can't figure out how to get this to work:

    TSharedPtr<IPropertyHandle> TemperatureProperty = PropertyHandle->GetChildHandle(TEXT("TemperatureDeltaCelsius"));
    //TemperatureProperty->SetInstanceMetaData("Units", TEXT("Celsius"));
    TemperatureProperty->SetToolTipText(LOCTEXT("TemperatureDeltaToolTipText", "Temperature delta (in \u00B0C)"));
    check(TemperatureProperty.IsValid());

    TSharedRef<SWidget> ValueWidget = TemperatureProperty->CreatePropertyValueWidget();
    ValueWidget->SetToolTipText(LOCTEXT("TemperatureDeltaToolTipText", "Temperature delta (in \u00B0C)"));

    HeaderRow
    .NameContent()
    [
        PropertyHandle->CreatePropertyNameWidget()
    ]
    .ValueContent()
    [
        ValueWidget
    ];
#

this is the code I have now and it doesn't do anything

hot notch
#

Wondering if there is a fairly easy way to disable but still display ComboBoxString entries? an example might be like the Livecoding dropdown here. StartSession being disabled, clicking on it does nothing, doesn't remove the dropdown, etc.

quaint zealot
#

Slate is the UI framework for Unreal

#

It cannot be disabled, it's the foundation for the entire editor UI, and UMG

#

Yes

#

Usually you'd use UMG for game development, not Slate

#

It's what UMG is built with

#

It's also what the editor is built with

#

And it's what you'd create custom UMG widgets with

daring laurel
#

how do you get the BPClass from a propertyhandle?

cobalt hare
#

is there a way to figure out the actual render size of a slate widget after it has been painted? the paint space geometry and tick space geometry both report the size that it attempts to render, but you can have off by one difference after viewport scaling is applied

#

i posted this in the umg channel yesterday -- all three boxes report the same size (square, that's what the numbers in each box are)

#

but if you open up that image and measure the actual size of the boxes, the top two are non-square by one pixel

quaint zealot
#

Don't think you can get that data back

#

Best to have the rounding happen at the tick level instead

rocky abyss
#

or you could floor your material sizes if needed

#

to match pixel rounding

cobalt hare
cobalt hare
#

this is what i'm doing now -- taking uv coord 3 (pixel size) and using that to convert uv coords to screen space

rocky abyss
#

what's the effect you're trying to get?

#

to render a background at it's texture size?

cobalt hare
#

yeah

#

you can see some stretching artifacts in the center of the box on the left

#

not on the image thumbnail, but the background

#

and the reason is that the reported pixel size in texcoord3 is one less than the actual width of the box

rocky abyss
#

right with the rounded coordinates meaning you could floor your texCoord3

#

so it's always rounded down to the nearest whole number

#

to match the width

cobalt hare
#

but the width is one greater, and only on one axis

#

if i take the ceiling, then the height will be wrong

#

it's supposed to be a square box, but after viewport scaling, depending on its screen position, slate renders it at a slightly non-square size

rocky abyss
#

😄 dat if statement

cobalt hare
#

the problem is there's no way for me to predict it -- it just depends on however slate is handling the viewport scaling, screen position, element size

#

what i am hoping is there is somewhere inside slate that actually knows the rendered screen size of a widget

#

but i haven't found it yet

rocky abyss
#

I'm not sure I never had an issue with coord3 not giving me the size of the widget

#

but I'm not quite understanding your need

#

here's a MF to scale and offset the texture to always be centered and scaled to fill the widget vertically or horizontally depending on which side is larger

#

so using the if statement to clear the vertical different from horizontal needs depending on the widget texcoord3 ratio

#

I round if I want snapping to fill each but that's for something else

cobalt hare
#

yeah this works great if you have an antialiased texture -- you won't notice being one pixel off here and there on modern resolutions for antialiased textures

#

but i guarantee if you compare the value of texcoord3 there with the actual screen size of your target, that when your dpi scale is not a round number, the size will be off by one here and there

rocky abyss
#

I'll see if I can dig further in for the one pixel off

#

depending on the DPI + widget size

graceful urchin
#

So I've got some custom BP nodes that have their own design and color that my team uses. It's super handy because they're really easy to spot in a graph. We have a plethora of BlueprintCallable functions with similar functionality that I'd also like to customize the look of. Is it possible to hook in somewhere and customize the look of a node if it has something like a specific meta tag?

tired valley
#

is there a way to make a slate widget that appears on all screens?

#

i want to do a saving/loading notification in my game

mild oracle
tired valley
#

i mean like, every level

#

across level transitions

mild oracle
#

I think there's a way of making UUserWidgets that are added to viewport by a PlayerController persist across levels

#

You don't need to use Slate to do it

orchid nova
#

Anyone know how to correctly do custom shaped hit areas for buttons? I got it kinda-sorta working but not really

#

Basically I have a custom SButton class which overrides MouseMove and compares it to a mask texture - that part of it works fine. If I have a button with a mask texture, it recognizes when it happens perfectly fine

#

The problem happens if I have my buttons very closely together, then the bounding boxes of the other buttons interfere with the hit detection and I'm not sure how to fix that

#

You can see the green boxes are the bounds for the two buttons on the sides, and the area with red is the only part on the top button where it recognizes the pointer

mild oracle
orchid nova
#

Yeah unfortunately that stops working when I have more than four :D

#

I guess in theory I could have multiple boxes represent a single button's hit area even if there's more, but it feels kinda iffy :\

#

this feels like such an obvious thing that there should be a way to do this, like somehow ignore the bounding box when it filters out what to hit test for but I can't quite figure out what that would be

mild oracle
orchid nova
#

Yeah I mean I have it working with MouseMove but I have no freaking clue what controls the bounding box

#

as long as the bounding boxes don't overlap it happily detects the button pixel perfectly

#

and I didn't find anything virtual in SWidget that would have hinted at having control over the box, so I'm a bit lost :D

gritty frigate
#

Maybe have it all as one big button and check which area has been clicked on

orchid nova
#

Yeah, I guess something like that could work, it's just a pain to make it display effects like hover states and such

#

I found the HitTestGrid thing, so that seems to affect it to some degree but even fully removing the element from the hit test grid doesn't get rid of the bounding boxes visible in the UMG editor, so I'm assuming that doesn't really do it (plus it makes the widgets completely ignore hit tests)

kindred nova
#

caleed from FSlateApplication::RoutePointerDownEvent

orchid nova
#

Lemme take a look at that...

#

Hmm, that might perhaps do something but I think it won't affect hovers unless it's named very confusingly

kindred nova
#

if it returns handled in 4699 it wont call OnMouseEnter on 4732

#

so hover state won't be set to true

orchid nova
#

Well I guess I can just try overriding it and hardcode it to always return unhandled or something to see if it has any effect :D

#

My hit test implementation basically just overrides OnMouseMove and uses it to perform a comparison against the mask texture, and calls MouseEnter or MouseLeave when appropriate

#

Nah that has no effect on it

kindred nova
#

returning handled when it is outside of button bounds didn't work?

#

there is also a FSlateApplication::LocateWindowUnderMouse which is higher

orchid nova
#

I think I need to try and see under what circumstances MouseMove is called because that's what triggers the hover state

#

I did notice that using the HittestGrid you can completely eliminate the hit detection on them, and it has a method to add a custom hit test shape but the interface it needs for that didn't make a whole lot of sense

#

funnily enough if you do HittestGrid.Clear(), even the editor UI stops responding lol

kindred nova
#
if (bAcceptsInput && Window->IsScreenspaceMouseWithin(ScreenspaceMouseCoordinate))
    {
        TArray<FWidgetAndPointer> WidgetsAndCursors = Window->GetHittestGrid().GetBubblePath(ScreenspaceMouseCoordinate, GetCursorRadius(), bIgnoreEnabledStatus, UserIndex);
        return FWidgetPath(MoveTemp(WidgetsAndCursors));
    }
#

also FHittestGrid::AddWidget

#

sadly it does only works with rectangles

orchid nova
#

Okay so it seems that OnMouseMove simply does not get called on the overlapped widget 🤔

#

Hmm, maybe I should try returning Unhandled or something from the overlapping widget...

kindred nova
#

there is also a OnCursorQuery

orchid nova
#

I see you're looking at the same code I was looking at for inspiration :D

kindred nova
#

oh

#

😄

#

out of four top google searches all reference same thing

orchid nova
#

Yeah I get the feeling it's just not a regular thing people want to do :P

#

I thought that I'll make my interaction menu a radial menu because they're neat and handy

#

but I'm tempted to just use a regular one because this is a pain lol

#

Okay so even if I hardcode mousemove to return Unhandled, the bounding box still causes the widget below to not receive input 🤔

kindred nova
#

so much hacking with slate, even making button not hittestable and adding transparent images over it for testing is a thing

orchid nova
#

Yeah, something like that could in theory work, it's just kinda annoying that it'll then pretty much require to reimplement UButton with its hover states and everything

gritty frigate
#

I think that if you return Unhandled, it passes the call to the widget's parents, not the next one down in Z

orchid nova
#

Yeah you might be right, that would make sense if it bubbles

gritty frigate
#

That's screwed me over in the past

#

lots of stepping through code to figure out why the widget I wanted wasn't getting the event

orchid nova
#

OnMouseMove is only called in two places in FSlateApplication, let's see if I can make any sense of it :P

kindred nova
#

i would expect SWidget would provide additional hittest capabilities with mask, but things like scaling, rendering and other possible transforms to implement smth similar to it make my head spin

in FHittestGrid

if (bAddWidget)
    {
        int32& WidgetIndex = WidgetMap.Add(&*InWidget);
        WidgetIndex = WidgetArray.Emplace(InWidget, UpperLeftCell, LowerRightCell, PrimarySort, InSecondarySort, CurrentUserIndex);
                auto WidgetHitTestMask = Widget->GetHitTestMask();
        for (int32 XIndex = UpperLeftCell.X; XIndex <= LowerRightCell.X; ++XIndex)
        {
            for (int32 YIndex = UpperLeftCell.Y; YIndex <= LowerRightCell.Y; ++YIndex)
            {
                //if (IsValidCellCoord(XIndex, YIndex)) // instead of this 
                if ((!WidgetHitTestMask && IsValidCellCoord(XIndex, YIndex)) || WidgetHitTestMask->IsValidCellCoord(XIndex, YIndex))
                {
                    CellAt(XIndex, YIndex).AddIndex(WidgetIndex);
                }
            }
        }
    }

#

since designers like to use too many non-rectangular objects in their UI designs

orchid nova
#
    FWidgetPath WidgetsUnderCursor = bOverSlateWindow
        ? LocateWindowUnderMouse(MouseEvent.GetScreenSpacePosition(), GetInteractiveTopLevelWindows(), false, MouseEvent.GetUserIndex())
        : FWidgetPath();
#

this seems to be how it determines which widget to send the mouse move events into

kindred nova
#

yes, inside it calls LocateWidgetInWindow which does hittest

orchid nova
#
        TArray<FWidgetAndPointer> WidgetsAndCursors = Window->GetHittestGrid().GetBubblePath(ScreenspaceMouseCoordinate, GetCursorRadius(), bIgnoreEnabledStatus, UserIndex);
        return FWidgetPath(MoveTemp(WidgetsAndCursors));
#

yep, so it's controlled fully by the HittestGrid

#

What I am wondering though is this seems to suggest this could return multiple widgets

#

but it does not look like it does, because it stops at the first one under the cursor

#

I wish the codebase favored early returns more than nesting long ass if-clauses... it would make a lot of this code so much easier to follow lol

kindred nova
#

when any widget is added to hit test grid it calls CellAt(XIndex, YIndex).AddIndex(WidgetIndex);

#

each cell is array of widget indexes

#

then it simply resolves them back

const TArray<int32>& WidgetsIndexes = HittestGrid->CellAt(X, Y).GetWidgetIndexes();
for (int32 WidgetIndex : WidgetsIndexes) ...
#

there is also

const TOptional<FSlateClippingState>& WidgetClippingState = TestWidget->GetCurrentClippingState();
                    if (WidgetClippingState.IsSet())
                    {
                        // TODO: Solve non-zero radius cursors?
                        bPointInsideClipMasks = WidgetClippingState->IsPointInside(WindowSpaceCoordinate);
                    }
#

nvm, it is not virtual

orchid nova
#

It seems the best bet at this point is being able to somehow give HittestGrid a more accurate box

#

It does not look like the ICustomHitTestPath has anything to do with being able to use a custom hit check so it's probably kinda complicated :P

#

it seems it may actually use the clipping mask as part of the hit test, so maybe it's possible to do something with that...

#

(in GetHitIndexFromCellIndex of FHittestGrid)

#

tbh the other easy'ish option is to just use some math to determine which "sector" of the radial menu the cursor is in and activate the appropriate widget from that (which just needs you to tell it how many sectors and the orientation and then it's just comparing angles)

#

it'll require implementing a widget to deal with the active/inactive states for the menu sectors but I guess it's not that big of a deal

kindred nova
#

if it is a radial menu i would simply use vector angle from widget center to determine button (and when cursor within menu widget) and not bother with custom hit testing. would also make it more use-friendly
but other things with specially shaped O X \/ buttons etc would think of custom hittest

orchid nova
#

Yeah, if I can't figure a good way of hittesting it that's probably what I'll do

#

it's just one of those nerd sniped situations at this point lol

kindred nova
#

😄

orchid nova
#

Yeah, it really looks like the bounding box is controlled by how the widgets are getting painted which you can't really override as far as I can tell. Paint sets a number of bounding box/clipping rect type values which are used in the hit checks, and there doesn't appear to be any way to modify those, and even if there was, it's plausible it would cause rendering problems or some other oddities

#

Oh well. At least the OnMouseMove implementation works pretty well overall, so it could be used for non-rectangular buttons as long as they don't overlap anything that needs inputs

gritty frigate
#

In your button, once you've checked if it's an actual hit, and it isn't, could you flip the visibility to HitTestInvisible and then call something that triggers another run-through of the stack that will ignore that button, and then once that's called flip your visibility back?

orchid nova
#

That's an interesting idea, I guess it could work but frankly it sounds like it's just going to become very complicated and the part of "call something that triggers..." sounds like a can of worms :D

gritty frigate
#

totally - I have no idea if you could even hook into the right place...

#

It's annoying that the stack of widgets that it asks if they want to handle a click is based on the top hit widget and all of its parents, rather than a stack of all of the widgets with bounding boxes under the mouse

orchid nova
#

Yeah... some parts of the code sort of suggests that it's supposed to be able to check multiple widgets under the cursor but in practice it doesn't appear to really do that. Not sure if it's an oversight or just confusingly named variables/functions

gritty frigate
#

I guess they were referring to the widget on top and its parents (which will normally overlap the same area)

orchid nova
#

Probably yeah

gritty frigate
#

I've been caught out when I had multiple children of an SOverlay that I wanted to pick up on mouse clicks

#

I wanted one to pick up right mouse clicks and another to get left mouse clicks

#

Ended up nesting one inside the other, which worked fine

#

Just was unexpected

#

Oh, there's an idea... Stack your buttons inside each other

#
SButton
  SOverlay
    SImage
    SButton
      SOverlay
        SImage
        SButton (etc)
#

All buttons would probably need to have the same bounding box

#

But if a button returns Unhandled(), then it will be passed into the next one down

orchid nova
#

maybe that's worth a try, I'm just wondering how well that'll work if the UI is scaled, getting them anchored so the layout remains the same might be a bit tricky

hot notch
#

Having some trouble understanding how to get the float back out of a TAttribute<FOptionalSize> set from the editor. In a function in the same class, I need to access that value for sizing purposes.

gritty frigate
#
const FOptionalSize& optionalSize = optionalSizeAttribute.Get();
float value = optionalSize.Get();

also:

float value = optionalSizeAttribute.Get().Get();
#

If the attribute is bound to a function, Get() will call the function (to update the internal value and then will return the internal value)

hot notch
#

Ah. Right. Wasn't processing the extra get.

gritty frigate
#

👍🏻

hot notch
#

Thank you thank you.

quaint zealot
vestal jasper
#

Hi I create a video play in widget method it's working perfectly in pc but the problem is when I export to android it's black screen appears
please any one give me the solution
I am searching for this 2 weeks but can't find anything useful please help me

quaint zealot
#

Don't multi post

vestal jasper
#

@quaint zealot ok sorry for that can you help me for that problem

ashen sedge
#

Hey guys, a little new to Slate so this might be going over my head but is anyone familiar with SListPanel? Found it while using the Widget Reflector and it sounded like it's something I'd want since I'm about to create a list of identical vertically placed items, but the Tick and NumDesiredItems has me questioning it. First off, are ticks only called when it's focused or did I read that wrong somewhere? And NumDesiredItems seems like I have to set it when I create it with SNew? It doesnt seem assignable after? For my list of items I have to be able to add and remove items throughout the game as certain things get built or destroyed, should I just be using a vertical box? I should mention that one of the things I need the most is to be able to sort and order the items in my list. Now that I say that I realize that I might even have to create my own custom sorting method, none of these have something like that right? How does one even sort through them actually, please dont tell me I have to remove them and add them again anytime I do a sort?

low bluff
#

I think the ListView widget is used in UMG for stuff like that. Might be worth checking the slate widget behind that

#

If you use a vertical box you'll have to clear and readd

#

I think listview does require that too but does it for you or so

#

Worth reading its code

#

@ashen sedge

ashen sedge
#

Alright thanks, I'll dig deeper into the code to see what I can find

cobalt hare
#

FUMGDragDropOp::New is giving me a linker error even though i have SlateCore and UMG in my public module deps

#

any ideas why?

cobalt hare
#

because the class isn't marked for export
class FUMGDragDropOp : public FGameDragDropOperation, public FGCObject

#

guess i'm supposed to make my own by inheriting directly from FDragDropOperation, which is exported

cobalt hare
#

hmm.. so i forked a local copy of FUMGDragDrop, and i now invoke BeginDragDrop directly in my own code

#

this creates a draggable widget that follows my cursor, but it doesn't trigger OnDragEnter events for other widgets

#

what do i need to hook into to make that work?

cobalt hare
#
void SObjectWidget::OnDragEnter(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent)
{
    TSharedPtr<FUMGDragDropOp> NativeOp = DragDropEvent.GetOperationAs<FUMGDragDropOp>();
    if ( NativeOp.IsValid() )
    ...
#

i guess that means it can't

#

has to be an FUMGDragDropOp to work with the builtin blueprint callbacks, and that type is not exported from UMG

ashen sedge
#

Ah dang, I was just going to ask about FDragDropOperation since I've been stuck on it for hours. I felt like I've been getting closer and closer but I just can't figure it out. There seem to be no examples at all on google or anywhere and I've been looking through the source code for hours without any luck. I don't understand FDragDropOperation.
Chris mentioned having to inherit from it, but even then, I inherit from it and do what exactly? What do I define in it or do with it exactly? This is the basics I'm assuming:

FReply SBasicInventorySlot::OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) {
    UE_LOG(LogTemp, Warning, TEXT("On Mouse Down"));
    if (MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton) {
        return FReply::Handled().DetectDrag(SharedThis(this), EKeys::LeftMouseButton);
    }
    return FReply::Unhandled();
}

FReply SBasicInventorySlot::OnDragDetected(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) {
    UE_LOG(LogTemp, Warning, TEXT("On Drag Detected"));
    return FReply::Handled().BeginDragDrop(???); //but how do I create a FDragDropOperation to pass in here? 
    ///**
    // * An event should return FReply::Handled().BeginDragDrop( Content ) to initiate a drag and drop operation.
    // *
    // * @param InDragDropContent  The content that is being dragged. This could be a widget, or some arbitrary data
    // *
    // * @return reference back to the FReply so that this call can be chained.
    // */
    // FReply& BeginDragDrop(TSharedRef<FDragDropOperation> InDragDropContent)
}

Or am I missing a step and attempting to get it too early and/or supposed to get it from elsewhere? What am I missing?

#

I even searched through the HeliumRain source code and couldn't find any OnDrag type event to my dismay. I have to be missing something obvious

cobalt hare
#

@ashen sedge i haven't tried making my own FDragDropOperation, but i would look at the SObjectWidget code as an example since it's used for all the UMG stuff
make a copy of FUMGDragDropOp as a starting point, and manage it from your widget the same way it's done in SObjectWidget

#

for example, i think you can answer your question in the comments above by looking at SObjectWidget::OnDragDetected

ashen sedge
#

Thanks for the help! I might be missing something here but I've looked at it many times already actually. I love that it's derived from SCompoundWidget which does make it seem like I can do the same, but unfortunately I think it uses certain Blueprint callables for UMG that I may not have access to (might be a UMG derived class). The problem being line 356 + 357 in SObjectWidget::OnDragDetected
this creates a temp nullptr UDragDropOperation* Operation = nullptr; to be filled by WidgetObject->NativeOnDragDetected( MyGeometry, PointerEvent, Operation ); I think
That's where I get lost since if it's a UDragDropOperation I assumed there's a Blueprint event that starts or gets the Drag and Drop operation and he sets it from Blueprints since I cant find it in code anywhere? I was hoping to do this in c++

cobalt hare
#

yeah NativeOnDragDetected is just calling the blueprint hook

#

but afaik your child class of UDragDropOperation doesn't need to have any functionality, it's just where you hold all of this info:

#

that info gets referenced from your FDragDropOperation, for example in FUMGDragDropOp you can see them using the pivot that is held by the UDragDropOperation to figure out where to actually display its visual

#

actually you don't even need the UDragDropOperation, it looks like that class is only used by FUMGDragDropOp so you could incorporate it directly into your FDragDropOperation class

#

yeah, looks like they just use that class to shuttle information from blueprints to FUMGDragDropOp

ashen sedge
#

Okay somehow I got it to work with just this

FReply SBasicInventorySlot::OnDragDetected(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) {
    UE_LOG(LogTemp, Warning, TEXT("On Drag Detected"));
    TSharedRef<FDragDropOperation> Operation = MakeShareable(new FDragDropOperation);
    return FReply::Handled().BeginDragDrop(Operation);
}

Didn't even have to define or do anything in it, OnDrop works now. I mean it's absolute basic but just surprised it worked honestly.
I'll have to figure out widget drag visuals and the other things tomorrow since it's midnight and my brain is fried. I'll start from scratch actually and look at the base slate classes to try and understand everything better. Hopefully can find a few good examples for it too but we'll see. FUMGDragDropOp definitely seems like the class to look at more though. Thanks again for all your help, really appreciate it!

warm vault
#

hey all, just wondering whats the best way to be loading in my images? would I load a transparent .png different than a .jpg? would loooooooove a quick example on what syntax i'd use to load my image files so I can set them in my SImage

gritty frigate
#

Are you after loading then dynamically, or are they static?

warm vault
#

static, I have all the files in my game folder in advance, so I hope that's what static is. when I import it it turns into a .uasset so I'm lost as to how to go about loading all my UI? do I create a hard reference to the path in a .cpp file and load all my textures that way? there's like FSlateBrush, FSlateImageBrush, FSlateDynamicImageBrush and not sure what to do lol. I thought it'd be as simple as getting a reference to the image, then just Image->SetImage(ImageFile), I mean that's what it seems like it still is but how do I get the reference, how do I create the type should it be and everything? 🤷‍♂️

#

I have a lot of UI, trying to learn ue4 by making a simple idle clicker game with tons of buttons so any tips on how to go about loading all the UI assets would be the best thing ever

#

not sure if I am googling the wrong thing but there doesnt seem to be anything that shows how to do this, which seems impossible since loading an image should be basic, not sure what im doing wrong

warm vault
#

I just noticed I can right click the imported texture and create slate brush, but there has to be a better way than to do that for every single icon/image. I guess I dont get how to load the texture file. UTexture2D* Texture = How do I load this so I can set it to an ImageBrush or something else

gritty frigate
#

Take a look at CoreStyle.h/cpp

#

Just pulling up an example from on of my projects...

#

You'd make your own style class, in the same way as CoreStyle. You'd set the content root to the root path that you want to use (my project is a plugin, so I have:

FString FMyStyle::GetStyleRoot()
{
    if( const TSharedPtr<IPlugin> myPlugin = IPluginManager::Get().FindPlugin( TEXT( "MyPlugin" ) ) )
    {
        return myPlugin->GetContentDir() / TEXT( "UI" );
    }

    return FString();
}

Then in your Create() function for the style, you'd have a load of lines like this:

style->Set( "Icon.Minus", new IMAGE_BRUSH( "Icon/Icon_Minus_Normal_26x26", icon26x26, FLinearColor::White, ESlateBrushTileType::NoTile ) );

And then when creating your SImage, you'd do:

SNew( SImage )
.Image( FMyStyle::Get().GetBrush( "Icon.Minus" ) )
#

In this case, Plugins/MyPlugin/Content/UI/Icon/Icon_Minus_Normal_26x26.png is the file it will use here

warm vault
#

that looks amazing, thanks SO much. give me a while to play with this, will let you know how it goes. love you

gritty frigate
#

you're welcome - good luck with it 🙂

warm vault
#

alright I give up for now...but only cause I have to go, I'll try this again later. I couldnt get my own version of CoreStyle to work so I tried to break it down to what it actually does. this is the most simple version i felt like it was doing

ImageBrush = new FSlateImageBrush(FPaths::ProjectContentDir() / TEXT("Game/UI/General/TestIcon.TestIcon"), FVector2D(64, 64)); //I've tried TestIcon.png too, I've printed the location to UE_LOG and it's correct
//and then
SAssignNew(Image, SImage)
.Image(ImageBrush)

but for some reason, that doesnt work, I was sure it'd work. oh well, i'll come back to it tonight. thanks a lot for trying to help, hopefully i'll figure it out tonight

gritty frigate
#

What's the path to your image? This will be looking for an image in Project/Content/Game/UI/General/TestIcon.Testicon. You'll certainly need to add an extension to the file in your code

warm vault
#

that's the exact path to my image, I logged it to make sure it was pointing to the right place. what do you mean by adding an extension to the file in my code though?

gritty frigate
#

What's your actual image file called?

warm vault
#

when I dragged it into the editor it got renamed to TestIcon.uasset and it's a texture file type. I also copied it manually as a .png into the same folder. I tried .usasset, TestIcon.TestIcon cause I saw that on google often and .png as well, none of em worked.

gritty frigate
#

Oh, with this you aren't referencing uassets - you're referencing the .png directly

#

There's no need to import it

#

Let me double check against my code

#

I think an issue you might have here is that doing it through the Style creates a texture atlas which includes it

#

I may be wrong on the atlas, though

#

So, to check, you have a file in:
C:/UE4/MyProject/Content/Game/UI/General/TestIcon.png
Can you then try it like this:

static FSlateImageBrush testIconImageBrush(FPaths::ProjectContentDir() / TEXT("Game/UI/General/TestIcon.png"), FVector2D(64, 64), FLinearColor::White, ESlateBrushTileType::NoTile);
SAssignNew(Image, SImage)
.Image(&testIconImageBrush);
warm vault
#

I have it in Documents/Unreal Projects/MyProject/Content/Game/UI/General/TestIcon.png that should still be fine right? also just to make sure, the only way to add the .png is to go in that folder and manually copy it in there, right? cause no matter if i add or import while inside the editor, it always turns it into a texture file, i never see the .png in the editor, but I do see it in the folder if I check manually.
and last of all just to make sure I'm not failing elsewhere:

ChildSlot
[
    SNew(SBox)
    .HAlign(HAlign_Fill)
    .VAlign(VAlign_Fill)
    .WidthOverride(64)
    .HeightOverride(64)
    [
        SAssignNew(Image, SImage)
        .Image(&testIconImageBrush)
    ]    
];

the SBox override is fine, its not ruining it is it? i just get a white box every time atm.
i just tried without the SBox just to make sure and its still a white box

gritty frigate
#

The SBox isn't going to cause this issue. A white box is what you'll get if it didn't find the image

#

I'm going to run a test here with defining the FSlateImageBrush directly in the Construct() function like that

#

When I do it like that, I also get a white box

#

I think this stuff may need to be in a Style rather than directly

split laurel
#

I'd assume it's due to the brush struct being destroyed at the end of scope and the widget merely takes a pointer, not a copy. But then I think the static version of it should work

gritty frigate
#

Their first go was using new, so it would be a memory leak, but it shouldn't be destroyed

#

That was why I flipped it to static

split laurel
#

True, hm. 👀 I don't believe image brushes would really need to live inside a style class. But then again, might be wrong

gritty frigate
#

I was thinking that my textures ended up in a texture atlas, but I'm not seeing any of my images in there

#

Actually, my icons are in the texture atlas

#

But then again, the style isn't created until the first ::Get() call on it

#

So it's not being pre-loaded anywhere...

split laurel
#

Due to performance concerns that does make sense, but I still don't believe that it'd be impossible to load images outside of styles

gritty frigate
#

I'm trying with exactly the same FSlateImageBrush constructor in both the style and in the widget's Construct()

#

And it works if I do it in the style...

#

If I add the same .png to the style and reference it in the widget directly, it works.
If I copy the .png to a second file, and reference that from the widget, it doesn't work

split laurel
#

Tested it out now, it does work for me.
ImageBrush = new FSlateImageBrush(FPaths::EngineContentDir() / "Editor/Slate/Icons/GeneralTools/Import_40x.png", FVector2D(40.f, 40.f));
with ImageBrush being a FSlateBrush* attribute in the widget

and the image being specified using

   .Image(ImageBrush)```
#

these weird arrows would typically be default collapsible arrows

gritty frigate
#

If that .png is already referenced in a style somewhere, it worked for me that way too

#

Try copying that file to Import_40x_new.png and referencing that

split laurel
#

ah I see. Can't test that right now but I did see some interesting comment in FInvalidateBrushAttribute which is what SImage is working with

#

seems like contents of addresses are swapped out underneath in some cases. Perhaps the styles offer some kind of consistency for usage that local brushes do not

#

but I'm pretty sure this goes deeper than some simple user error

gritty frigate
#

yeah - I think that creating a style is certainly the way to go

#

@warm vault let me see if I can create you a style template to use

split laurel
#

I never did it differently so it's an interesting issue

gritty frigate
#

@warm vault Try using this as a template for your style:

#

And then in your widget, make sure you include MyProjectStyle.h, and then use:

SNew(SImage)
.Image(FMyProjectStyle::Get().GetBrush(TEXT("TestIcon")));
#

@split laurel I dropped a breakpoint into my style's Get() to see when it was first initialised. It's happening for me when the CDOs are created, as I have a few UMG widgets that wrap my Slate widgets. I'm getting the style for the UMG widgets in their constructors

#

Anyway, I need to get back to my actual work now 🙂

warm vault
#

Hugh, you are insanely awesome. so calling it in the Construct() was causing some weird issue? sorry for disappearing, completely lost track of time and was late for something.
anyway, the MyProjectStyle template works P-E-R-F-E-C-T-L-Y. I can't thank you enough. thanks to both of you for going out of your way to help, I will be eternally grateful for helping me get started since that's always the hardest part. the only thing I had to change was ProjectConfigDir() to ProjectContentDir() but I mean that's the least I can do. the icon loads without any issues now. you are the BEST

gritty frigate
#

Thanks 🙂 And apologies for the ProjectConfigDir() - that would have been an autocomplete mistake

#

Glad it all works for you!

warm vault
#

oh please dont apologize at all, you went above and beyond and i genuinely cant thank you enough for helping me get this to work and pointing me in the right direction.
so do you use a single CoreStyle class like this to handle ALL of your UI, this is the way in UE? You create the brushes in your CoreStyle.cpp and then just use Get()->GetBrush() to assign it to your image? a single class for every single image in your game? from entire loadscreens to items to everything?

gritty frigate
#

Yup. The Create() function does all of the heavy lifting. All of the images, plus all of the different widget styles

#

I do this up near the top of the function:

const ISlateStyle &coreStyle = FCoreStyle::Get();

Because sometimes I want to get a UE core widget style and extend it

#

Fonts as well

#

Anyway, I've got to run - glad you've got something working now 🙂

warm vault
#

thanks so much for taking the time to help again! sorry it took so long and hope you have an amazing day and weekend

gritty frigate
#

No worries at all. You too!

mild oracle
# warm vault thanks so much for taking the time to help again! sorry it took so long and hope...

I don't know if it helps but there's a way to stop Unreal trying to auto-import stuff like that.
You can create MyProject/Config/DefaultEditorPerProjectUserSettings.ini and put something like this inside:

[/Script/UnrealEd.EditorLoadingSavingSettings]
+AutoReimportDirectorySettings=(SourceDirectory="/Game/",MountPoint="",Wildcards=((Wildcard="*.csv")))
+AutoReimportDirectorySettings=(SourceDirectory="/Game/WwiseAudio/Windows",MountPoint="",Wildcards=((Wildcard="*.*")))

This stops UE4 from trying to import any csv files inside the Content directory, for example.

warm vault
#

oh that's super cool to know actually! thank you for the code example, if I dont end up needing textures often as I get more familiar with unreal, I can totally see myself disabling the auto-import so I can just drag and drop instead of having to go about it manually. very useful, thanks a bunch!

#

this actually makes me want to ask, i remember reading something about how unreal is really good with optimizing things and that i should be adding .psd directly. should i be doing that instead of pngs and jpgs and probably have to set alpha manually or what's the best way to be using stuff in unreal?

mild oracle
#

@warm vault I'm not sure about that, I tend to decide what format to keep my raw assets in depending on my team members. If it's just me, .psd is fine, but if I'm working with others I go with .png so they can overwrite even if they're using other software.

You should also make sure you set your data source directory so all your paths are relative 😉

warm vault
#

uuuff, that's a little overkill for me right now but i love the auto compression settings, pixel format and prefixes, and everything else too. good chance i might use it later just a little too new to start using it right now. bookmarked and thanks for sharing!
how do i set my data source directory?

mild oracle
#

Editor Preferences > General > Miscellaneous > Import > Data Source Folder

warm vault
#

ohhhhhh, interesting. does that create a better link between the original asset and the imported one so you can re-import easier or whats the difference between this and the normal source path the imported file keeps?

mild oracle
#

Instead of saving the path to the asset as C:\MyDocs\Blah\Blah which is unique to your machine, the idea is it saves it as a relative path, so another team member on a different PC could just hit the reimport button.
Say you store your raw assets in a repository or Dropbox or something, all team members would set their Data Source Folder to be that, so reimporting works (because it's a relative path)

warm vault
#

oh, makes sense. thats very nice actually, thanks for explaining. im sure down the road that can become a huge life saver

split laurel
#

keep in mind though that you wouldn't typically use slate for in-game UI. Not sure what your goal is, but seeing as you want to get more familiar with Unreal and you mentioned things like items I wanted to point that out

warm vault
#

oh dang, i must have misunderstood? from what it seemed like, UMG was sort a WYSIWYG editor and works perfectly fine, but is less performant if you have a ton of UI especially if you're binding a lot of it through c++? i also thought UMG was just an extension from slate to make it more user friendly. so i shouldnt be making my in-game UI in slate even if this first game i'm working on is basically almost all UI elements? idle clicker game that is filled with buttons, text, progress bars, all constantly being updated with inventory, talent tree and just UI all over the place? granted if it's just a UI game it wouldnt be too intensive even if its all done in UMG but i figured i might as well learn slate so i can reuse my inventory and talent tree mechanics since it'd be easier than copying blueprints to a new project?

split laurel
#

There's a lot to dissect here; you are right that UMG is built on top of Slate. The heavy computations come from the value bindings which are executed per frame. If you don't use value bindings you won't incur a much larger cost. These bindings are also often used in slate, if wanted, so this really comes down to the implementation.
If you worry about UI performance, I wouldn't stress it. This is also often observed with beginners when it comes to Blueprints; barely starting out, but trying to dive into C++ because they heard it's more performant when they lack critical game dev skills in the first place; the order of priorities is wrong.

If you are interested in slate & editor tooling anyways, sure you can proceed using slate. But if your primary goal is getting your game done, use UMG; it's there for a reason

#

another reason to invest into slate is that you can expand UMG with your own widgets. All UMG widgets have a slate counterpart beneath. So you can write new kinds of widgets in slate, expose them to UMG, and then continue doing your ingame UI in UMG

warm vault
#

i see, thanks for explaining things. i'm a webdev who wants to pick up unreal so you're right about being a beginner with c++. honestly i didn't expect it to be so interesting just to load my image. to me creating UI seemed easier in code since i'm used to it and i can easily do a for loop for however many inventory slots i have from a custom SCompoundWidget that holds all my styling and code. but i guess i'm not familiar with blueprints either and it might be just as easy to do it there. ill play with both for a week or so and see which path i prefer but it does sound like UMG is made to do this and make life easier. sorry for all the newbie questions and i really appreciate everyone's help and pushing me into the right direction

split laurel
#

it's absolutely fine, everyone needs to start somewhere and you have a much better foundation than many people on here asking questions that should be left to googling. Slate especially is essentially not documented at all. A few years ago there were even fewer resources on plugin development for unreal than there are now. Basically everyone halfway adept at slate has spent the hours doing trial & error reading source code

#

and yes, in UMG you do the same kind of object oriented programming that you do in C++. Create widget that owns a grid view, get grid, for loop, add items to the grid at position (X,Y) and so on. It's really the same stuff that you would do in C++, but easier to pick up and iterate upon. Slate UI requires constant recompiling and just eats up your time

warm vault
#

one last question if you don't mind. this is the talent tree from one of the games i'm getting inspired by, path of exile: https://i.imgur.com/OmiiEjQ.jpeg
one of the reasons why i was thinking about slate is because i thought i could create the talent tree faster in my friendly web dev environment and then export all the styles and positioning in JSON and was hoping to essentially create the talent tree in-game from that JSON data. i could then also provide the JSON data to players if any of them wanted to create third party tools for it. having said that, i could probably create the JSON from c++ as well now that i think about it though. so i guess my question is, seeing that talent tree, would you say UMG is fine for that or what would be the best approach to working on something like that?

split laurel
#

I honestly have never done much work on game UI, so I wouldn't be able to speak from experience. I do believe that UMG could be fine here, as long as your UI architecture doesn't rely on bindings per-node. Basically you want to create the data once and then just let it render.

patent falcon
#

The slate sounds that are bound to buttons, on which UAudioComponent do they play?,,, I tried to check but I found that it gets the AudioDevice directly from GEngine!
I'm not sure if it's the right channel but it's slate related

split laurel
#

and as a rule of thumb, having an eye for optimization is good, but premature optimization will bottleneck your iteration speed just as much as overengineering code architectures does. So I'd say: just go for it, see what you can do, test it out using UMG, observe performance. You will notice quickly if performance is a worry to have or not, and if it is, you can still turn to optimization and if you did everything you could and it doesn't run, then you can still use slate

warm vault
#

yeah you're right. slate seems like a lot more time investment than i initially imagined and in the long run it'd still be faster to do everything in UMG even if i had to switch later since i'll just be more familiar with the entire system and picking up slate will be faster and easier than it is now anyway. thanks a lot for your time and support, this probably saved me loads of time going forward and i really appreciate it.

warm vault
split laurel
#

@warm vault Slate attributes can be assigned either a value, or a function binding, so that whenever the attribute is accessed the function is executed. Depending on the function and how often it is called, this can become expensive real quick.
A simple example is:

Direct value:

SNew(STextBlock)
.Text(SomeTextVariable)

Function binding

SNew(STextBlock)
.Text(this, &MyClass::CalculateSomeText)

now the CalculateSomeText function will be called each frame. If it's expensive and you have 500 texts like these, the big optimization judge will give you a bonk

warm vault
#

Sorry I'm a UMG user who just checks up on the slate channel in case I ever have to switch to it. I think I understand, and please correct me if I'm wrong, but the expensive binding everyone talks about is only when you create a function binding, because then like you said, whenever the attribute is accessed it has to call the function? Does that mean that UPROPERTY(meta=(BindWidget)) isn't expensive? From what I understood, I thought it has to create the binding each frame to make sure there's a link or something along the lines, and that's what I thought bindings being expensive meant? I tried to do everything in UMG while creating as few UPROPERTY(meta=(BindWidget)) as possible so that I don't end up with hundreds of such cases, or was I right to try and not go crazy on these types of bindings as well UPROPERTY(meta=(BindWidget)), even if I were to use or set direct values?

split laurel
#

that meta specifier is something completely different, and I don't think this has any noticeable impact on performance. Function bindings are typically what is meant when someone talks about bindings in regards to UI and performance concerns

#

I haven't ever worked with it though so someone else could give a better answer perhaps

warm vault
#

Wow, great to know.

split laurel
#

rule of thumb as always: don't use tick if you don't need it, and if you have to use it, don't put heavy stuff in there. If you need to put heavy stuff in there, make sure there aren't many instances running. You can continue this chain forever really. UI isn't some magical place. It's rendering + programming and common rules apply

#

keep in mind though, attributes don't necessarily call their functions on tick. It's just that a lot of widgets natively do, i.e. a text block asking "what text should I display this frame? -> call the function"
There is nothing hindering anyone from having a function binding that is only executed when deemed necessary, whatever that means for a specific case

warm vault
#

I can legitimately say I don't have anything on tick. Everything is set based off events, mouse events or collision events etc. I do have a lot of UPROPERTY bindings through the meta specifier to get access to a lot of widget components though and I don't know why but I thought those bindings or pointers we're checked every frame or something and that's where I thought the expensive binding thing came from. My profiler looks good though so I haven't been worried, I was just curious after I read your message. I don't see why I'd ever want to use slate than except to create custom widgets or something that UMG can't do. I had this stone on my chest in case it ever became an issue in the future and I'd have to remake some things in slate but doesn't seem like I have to worry about my kinds of bindings though, you rock.

split laurel
#

if the profiler doesn't lie, it wouldn't matter even if those bindings were expensive :)

craggy holly
#

Slate exists outside the concept of worlds/actors etc, so using an actor component to play sounds doesn't make much sense there.

patent falcon
#

well, I have a work-around for it which is to set UI sounds to lower priority and that solves it for now! but it's not a good way to leave it like that!

cobalt hare
#

maybe you can pass an audio component into your slate widget hierarchy? and use that to play sounds instead of playing them via slate

craggy holly
#

Just put them in a separate concurrency group, there is a max voice count though - it's pretty low by default, 16 or 32 I think.

#

You can set audio quality levels (aka num channels) in project settings

#

We use 128 by default

mild oracle
#

I have something that looks like this:

#

Can I ask how you're doing the expandable tree? Is it something in UE4 or custom?

split laurel
#

Yeah, just the editor style isn't going to cut it here :) that looks fine mostly. Although I wouldn't use project plugins dir as the base, as you could also install it in the engine. You can lookup a plugins directory directly if I recall correctly. Don't remember how. Maybe from the module manager

sharp zinc
#

Hey, ppl.
Any idea on how to get a handle to an FString when it comes to detail customization?

patent falcon
warm vault
#

You would need to inherit from SMultiColumnTableRow. Then override GenerateWidgetForColumn. Then add a SExpanderArrow on the column you need. You will also need a method for your GetChildren.

mild oracle
#

If you check out my Localization plugin you should see how I set up the icons

#

This is open-source? Or you work at Bioware?

warm vault
mild oracle
magic temple
#

Hey, I'm new to slate and can't seem to figure something out: How do i clear the content of an SVirtualWindow, or SWindow after using the SetContent() method?

#

Turns out I was looking in the wrong place. I found the SNullWidget::NullWidget and calling SetContent(SNullWidget::NullWidget) worked

tired valley
#

is there a way to categorize items in a UTileView?

ashen sedge
#

I feel pretty comfortable creating UI now but I'm trying to wrap my head around the workflow for a game overall. Please tell me if I am understanding this right?
The main menu is basically a level by itself that might have it's own MainMenuHUD and MainMenuPlayerController, and then once you go in game you'll be switching to your InGameHUD and InGamePlayerController, but ultimately you add practically all your UI to the InGamePlayerController right? And you only really have one HUD for each level, right? It's obvious the unique player's health and inventory and action bars go with the player, but even if you had global widgets that look the same for all players that dont depend on the player, they'd still go to that PlayerController right? Or am I misunderstanding something? I've seen examples where CreateWidget<UUserWidget>(GetWorld(), SomwWidgetClass);, but I'm not quite sure I understand why you'd send the UWorld as a parameter? Seems like you can even send UGameInstance and others as well, but why? Under what circumstances would you want to use those? I mean the parameter is called OwningObject but it makes sense if the PlayerController owns it, but why would the World or GameInstance own it? I guess that part doesn't make sense to me and if there's typically only one HUD for each level and if it should all go to your PlayerController as the owning object.

craggy holly
#

It's better IMO, to use the HUD class as a widget manager/widget container - and pass the owning controller in as the widget owner.

low bluff
#

The whole PlayerController stuff becomes very useful when you use Splitscreen and local Coop

#

Because then you need to have different Players owning different UserWidgets

#

Theoretically you don't need to care about it otherwise

#

Because getting the Controller via GetPlayerController or via GetOwningPlayer is no difference

#

(given you don't plan on doing local coop)

#

Not sure if gamepad input requires a PlayerController even for non local coop

#

But generaly said, I also always use the PlayerController as an owning object

ashen sedge
#

By widget manager/container you mean the HUD holds a reference to the widgets you use and the owning player controller is the widget owner? That makes sense

low bluff
#

Yeah, cause the AHUD Class is otherwise useless

#

Or rather, not needed

#

It has its uses for debugging

#

I actually handle my UI in the ULocalPlayer

ashen sedge
#

And awesome eXi, you're basically saying that theoretically it doesn't matter at all who the owning object is if you dont plan on supporting gamepad or do local coop, but keeping it in player controller just makes more sense in case you ever need it and is good practice for that, but also keeps things nice and neat, all in one place

#

Knowing it doesnt matter helps, was way overthinking it. But of course that doesnt mean I'll just add em randomly and it makes sense to keep it close to the player, thanks a bunch

chrome jasper
#

i need the ExtendMenu key for this hook in unreal engine 5

#

found it its "Content"

tired valley
#

how do you create right click menus in C++ slate? is there a good tutorial or example?

mild oracle
# tired valley how do you create right click menus in C++ slate? is there a good tutorial or ex...
GitHub

Simple CSV localization system for Unreal Engine 4 - UE4-BYGLocalization/BYGLocalizationStatsWindow.cpp at main · BraceYourselfGames/UE4-BYGLocalization

#

It depends on where you want to show it

tired valley
#

thank you!

ashen sedge
#

How are you all handling your drag events? I had my widgets that inherit from SCompoundWidget working fine, but I switched to inheriting from UUserWidget so I can build my widgets in BP while wanting to keep the logic in C++.
This works fine and calls OnDragDetected for slate widgets

FReply SBasicInventorySlot::OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) {
    UE_LOG(LogTemp, Warning, TEXT("On Mouse Down"));
    if (MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton)
    {
        return FReply::Handled().DetectDrag(SharedThis(this), EKeys::LeftMouseButton);
    }
    return FReply::Unhandled();
}

but I can't get the equivalent for umg widgets to work. DetectDrag expects a TSharedRef<SWidget> and I've tried 2 different ways to pass it and while the first works fine, NativeOnDragDetected never gets called. Am I going about this the wrong way, are you guys doing something easier?

FReply UInventorySlotWidget::NativeOnMouseButtonDown(const FGeometry& MovieSceneBlends, const FPointerEvent& InMouseEvent) {
    UE_LOG(LogTemp, Warning, TEXT("On Mouse Down"));
    if (InMouseEvent.GetEffectingButton() == EKeys::LeftMouseButton) {
        return FReply::Handled().DetectDrag(MyWidget.Pin().ToSharedRef(), EKeys::LeftMouseButton);
        // return FReply::Handled().DetectDrag(TakeWidget(), EKeys::LeftMouseButton);
    }
    return Super::NativeOnMouseButtonDown(MovieSceneBlends, InMouseEvent);
}
lavish carbon
#
    if ( InMouseEvent.GetEffectingButton() == DragKey )
    {
        FEventReply Reply = UWidgetBlueprintLibrary::Handled();
        return UWidgetBlueprintLibrary::DetectDrag(Reply, this, EKeys::LeftMouseButton);
    }

    return UWidgetBlueprintLibrary::Unhandled();

try this @ashen sedge

#

you will need #include "Blueprint/WidgetBlueprintLibrary.h"

#

and also "UMG" api must be added in dependency module list.

#

take a look at WidgetBlueprintLibrary.h and see how things are done there. for example see DetectDragIfPressed function

ashen sedge
#

Oh dang, WidgetBlueprintLibrary is sooooo helpful. Thanks so much for letting me know about it, surprised I haven't heard or seen a reference about it, MASSIVE help, thanks a bunch. Got it to work from your example, much appreciated!

lavish carbon
ashen sedge
#

That makes sense. I'm still newish to UE and have been doing mostly everything in c++ and when I'm lost I depend on source code and google, but I guess it makes sense to see how its done in blueprints too and then check the source on that, especially for UMG since it was practically made for that, thanks!

obtuse tendon
#

Does anyone tested the CommonUI in the plugin/experimental ? I'm curious about that CommonGameViewport that redirects the input to UI first (the other stuff as well).

limpid fractal
#

anyone knows why I cannot select my Slate (UMG Wrapped ) widgets in widget editor with mouse click?(I've other widgets with same parent class that can be selected and also widget is working as expected in play in editor )

low bluff
#

Fighting with Focus atm and I wonder why ShooterGame and similar do this:

FReply SShooterMenuWidget::OnFocusReceived(const FGeometry& MyGeometry, const FFocusEvent& InFocusEvent)
{
  // Some other code
  [...]

  return FReply::Handled().ReleaseMouseCapture().SetUserFocus(SharedThis(this), EFocusCause::SetDirectly, true);
}
#

Specially the SetUseFocus(SharedThis(this), ..)

#

Shouldn't OnFocusReceived already call when this Widget has focus? Why is it asking for focus on itself? I would expect it to give focus to the first button of its list or so.

low bluff
#

Ah okay, ShooterGame mixes manually handling its UI and Focus. They only focus the Menu, and the inner button selection is actually via an array and an index.

#

Buttons never actually have focus and the button press is simulated

quaint zealot
#

ShooterGame is the worst possible thing to look at for UI

low bluff
#

Yeah I figured by now

#

I mainly look for a clean way of handling focus throughout the whole game.
We have so many issues with losing focus or with things not receiving focus when they should due to frame delays being needed etc.

craggy holly
#

tbh the way we've done it is with a big if/else function in the HUD

#

everytime we add a new widget to the screen, just call "UpdateFocusAndMouse" which determines what should be focused and whether mouse should be visible

low bluff
#

My default approach was always that I have a FocusableWidget and that everything that can receive focus uses that as a base class. And when it receives focus it gives its "inner widget" focus, which would chain down to some native UWidget, like a button

craggy holly
#

It's the only sane way I've managed to get around it so far

low bluff
#

+- moving the mouse over the button to use the same highlighting for mouse and gamepad.

craggy holly
#

Yeah, tbh that should be a standard feature IMO

low bluff
#

Yeah but I have so many issues with this

#

E.g. the MainMenu has a List of Buttons (custom) with a native button.
I click into the MainMenu background and that gives the first button focus.
I do that 3 more times and teh MainMenu just keeps the focus and doesn't give it further

#

Why? no idea. Probably cause slate hates me

quaint zealot
#

I also independently made the same decision as Cedric

#

Each menus keeps track of its current focus

#

If none is found, it picks a default

#

Er

low bluff
#

Yeah it makes total sense to do that. That way you can just say "Focus the Menu" andi t figures it out

quaint zealot
#

That was Jambax

low bluff
#

Ah so James/Jambax decision?

quaint zealot
#

Yeah, I basically handle focus myself to a large extent

low bluff
#

I think the main issue I have is the random problems I can't comprehend

#

Focusing the MainMenu 3 times in a row breaks it, even though the code is the exact same.
You can see in the slate debugger how each click removes one widget from the tree (data wise) until the last click only has teh MainMenu widget and focus is lost

#

Like whyyyy

#

(well not lost, but if the MainMenu has focus and its job is it to give its focus to its inner widget and it doesn't do that anymore, then things break)

#

Ah well, guess another day of breakpointing slate/umg code to figure out what is going on

#

Would be too easy to make Slate/UMG work out of the box with Mouse/KB/Gamepad without the devs having to fight it

#

Raaant

#
LogSlateDebugger: Mouse Button Down - (SPIEViewport [PlayLevel.cpp(3134)]) - []
LogSlateDebugger: Focus Changing(0:Mouse) - WB_Button [Button_Base] -> WB_Menu_MainMenu [WB_Menu_MainMenu_C_0]
LogSlateDebugger: Focus Changing(0:Mouse) - WB_Button [Button_Base] -> WB_Menu_MainMenu [B_Play]
LogSlateDebugger: Focus Changing(0:Mouse) - WB_Button [Button_Base] -> WB_Button [Button_Base]


LogSlateDebugger: Mouse Button Down - (SPIEViewport [PlayLevel.cpp(3134)]) - []
LogSlateDebugger: Focus Changing(0:Mouse) - WB_Button [Button_Base] -> WB_Menu_MainMenu [WB_Menu_MainMenu_C_0]
LogSlateDebugger: Focus Changing(0:Mouse) - WB_Button [Button_Base] -> WB_Menu_MainMenu [B_Play]


LogSlateDebugger: Mouse Button Down - (SPIEViewport [PlayLevel.cpp(3134)]) - []
LogSlateDebugger: Focus Changing(0:Mouse) - WB_Menu_MainMenu [B_Play] -> WB_Menu_MainMenu [WB_Menu_MainMenu_C_0]
#

This is the log of 3 clicks

#

First one ended on the Button_Base which is a native butotn

#

Second one stopped on B_Play which wraps the native one

#

last one only did the menu

#

;_;

quaint zealot
#

🤷‍♂️

#

Focus is really weird

low bluff
#

Yeah I know I can't get help about it. It's sad. Epic could invest into this a bit

#

I feel they largely gave up on UMG again or so

#

Or rather focus in general idk

quaint zealot
#

One of the main things I developed for new projects after Helium Rain, which was impossible to add proper gamepad nav to after the fact, is a custom menu / navigation / focus system, which essentially means I have "navigation panels" that store their focus state, have a callback for the current default focus button depending on what's visible, call the engine's navigation method but without relying on the actual engine focus

#

Then my top level menu handles all input, including nav keys, routing that to the current panel

low bluff
#

That's kinda how ShooterGame does it though

#

And I think that's all fine

#

But it's hard to make one big system that works for everything if you are a contractor

#

Next Client asks for a Menu that works different and the work is worthless.
That's why I would love to have UE4's navigation just "work"

quaint zealot
#

Yeah, I couldn't push that framework onto every game if I contracted

#

Though like, something like the Ascent is very reminiscent of what I have now

low bluff
#

The Ascent uses focus directly

#

And suffers from it

#

But you can't blame someone for using Epic's system and it's shite

#

Like, the UI works and is easy to contruct

#

It's not the "making it work" that is the problem

#

It's the pitfalls everywhere

quaint zealot
#

Focus and nav is the main thing that I feel Slate is bad at

#

Well, "bad"

#

It's desktop oriented

craggy holly
#

Also really hard to actually debug as well

#

Like, the widget reflector is total rubbish tbh

quaint zealot
#

It's extraordinarily complex and full-featured with boundary escape rules and all

#

But it's desktop oriented

#

Games need realllly simple nav rules

craggy holly
#

yeah

low bluff
#

I would love to know what Fortnite does

quaint zealot
#

And they need reliability, like always have a focused button

low bluff
#

I know they move the mouse ontop of the elements (not sure how that works on Consoles?!) to highlight them

#

At least that was said ages ago

craggy holly
#

Wonder if they use the same "virtual cursor" thing on FN, just hidden

#

Paragon did that too IIRC

low bluff
#

Could be if that's an option

#

Maybe I should annoy some Epic peeps to get some info about Fortnites Menus and Gamepad support

#

It's probably something they can easily fill a livestream with

craggy holly
#

Maybe we'll get some new samples when UE5 releases out of beta 😄

quaint zealot
#

Basically I feel Epic could have what I have now, which is a SCompoundWidget menu class that simply handles focus on all its children itself in a failsafe and gamepad oriented way

#

Inherit that and forget about your troubles

low bluff
#

That's the thing though. What you have as an SCompoundWidget is what I have as a UUserWidget

#

It's supposed to handle focus in a failsafe way. And maybe I just suck at making this work, but it's just not failsafe due to whatever happens internally in Slate.

#

A sane mind would expect focusing a widget, that then forwards focus, to work 100% of a time.

#

can't type..

#

Spammed Amanda with asking for a future stream about proper UI/UMG/Slate Focus/Navigation handling with maybe some Fortnite stuff. Maybe they like that idea and Nick Darnell or so comes back with some wisdom. Probably not in time for me to learn anything.

quaint zealot
#

There's clearly a lot of stuff that's more advanced than the usual stream topics that I'd love covered

#

I never managed to have primary data assets affect chunking, for example

#

The doc explains some stuff, not nearly all of the tools related, and my experience is that none of it works

low bluff
#

Short off topic about the PrimaryDataAssets. I had them nested, so a Soft Ref of a DA in another DA. That is bugged :D It resets the inner reference every time the editor restarts.
If you open the outer DA you can still see it assigned, but when you want to use it in code it's null.

quaint zealot
#

Yeah but I mean, basically putting a PDA in a folder, making it tag the folder, and setting the chunk ID - there is no version of this that works for me on 4.26

#

Chunk rules only work on levels as far as I've tried

low bluff
#

I changed the place at which I forward the focus to the "inner widget", now the clicking of the button works as intended

#

Lovely

#

Doing it now in NativeOnFocusReceived via the reply

#

Before it was via the SlateUser by hand in the FocusChanged function

blazing sierra
#

Does anyone know if there is anyway to capture a particular widget's display as an image via C++?

#

To clarify, I don't want a screenshot since the target widget will likely be overlapped by another widget.

mild oracle
obtuse tendon
ionic thunder
#

I am creating and spawning an SDockTab, through the FGlobalTabmanager as a nomad tab. However, the Tab is spawned in front as a floating tab by default and needs to be docked manually. How I can adjust the code so that is spawned and docked automatically (e.g next to world outliner or any other opened category) ?

//Register dockable tab
FGlobalTabmanager::Get()->RegisterNomadTabSpawner(
CustomTabID,
FOnSpawnTab::CreateRaw(this, & FCustomUnrealEditorModule::SpawnDockableTab))
.SetGroup(WorkspaceMenu::GetMenuStructure().GetLevelEditorCategory())
.SetDisplayName(FText::FromString(TEXT("Custom Tab")));

//Invoke tab
TSharedRef<class FGlobalTabmanager> tm = FGlobalTabmanager::Get();
tm->TryInvokeTab(CustomTabID);
prisma lark
#

Hello everyone, Maybe someone knows how can i add UMG widget to my slate widget using c++??

mild oracle
hallow yarrow
#

Does anyone knows why the brush done as a material is not working and the other one yes?

#

I have a material that with some effects does some cool things and I want to put it in the loading screen

rich imp
#

I'm unsure to what channel this question goes into so im reposting from UMG, but pretty much I have a transparent button “border” texture for my inventory slot and was wondering how I would go to change the slot color? I’ve tried to set style, button style, slate style and specified style but it would just put a regular image block overriding the texture. Any help is appreciated

spring frost
#

Does anyone know if there is functionality where the slate thread goes to sleep when the game window is Alt+Tabbed away from for a while.

#

Im getting a strange issue where, our Killfeed will spam the user with old entries if they Alt+Tab away from the game for a few minutes and then return.

#

Not sure if its slate thread or game thread related.

#

Im just not even sure where to start on this one.

low bluff
#

Can you repro it?

#

First thing I would try is to repro it and breakpoint the widget creation stuff. Then you can check what the callstack is

spring frost
#

Yeah thats the other hard thing about it is I cant actually repro it.

#

Seems only one of our QA guys gets it.

#

Or hes getting reports of it from another user.

low bluff
#

Ask if you can teamviewer in when it happens?

#

Get the savegame from them and see if that maybe helps?

#

Those situations are always shite

versed harness
#

Is there a way to add a FUICommandInfo as a button when constructing slate? In here for example:

frosty prawn
#

How do I make an SButton call a function with parameters?

lavish carbon
lavish carbon
#

you also need to define and implement this function FReply OnClicked_DoSomething(Param1, Param2)

versed harness
lavish carbon
#

put a toolbar in your verticalbox slot

versed harness
#

Alright thanks, I willa try it later and see if it works

frosty prawn
#

yet it gives me an error that OnClicked_Raw does not take 4 arguements

lavish carbon
#

maybe this, I think there is an option to make the toolbar vertical as well. @versed harness

SVerticalBox::Slot()
[
   MyToolBarBuilder.MakeWidget()
]
lavish carbon
#

does it have to be static?

frosty prawn
#

no, but even then it's the same error

lavish carbon
#

in which class you are calling OnClicked_Raw?

#

if it's a widget you must use OnClicked, not the Raw version.

frosty prawn
#

Im using it on SButton

lavish carbon
#

Yes, but you are writing this code for a class. what is your class that you are calling this from?

frosty prawn
#

my plugin class, FC2MModule

lavish carbon
#

since your function is static you can do
.OnClicked_Static(&FC2MModule::OpenDirectoryDialog, outputPin, folderPath)
or
.OnClicked_Static(&OpenDirectoryDialog, outputPin, folderPath)
depends on where you put OpenDirectorDialog function declaration.

#

but this should work as well. .OnClicked_Raw(this, &FC2MModule::OpenDirectoryDialog, outputPin, folderPath) just remove static from your function and make sure to put it inside FC2Module.

frosty prawn
#

I tried using .OnClicked_Raw with the function not being static, that still won't work because it says OnClicked_Raw takes 2 arguements and I gave it four