Download

Slate - it's a lot to take in! - Help on button designs

Hi everybody!

So I’m finding my way around Slate and so far I’ve managed to build a very basic main menu consisting of 4 buttons and a cursor. I have a few questions that I hope someone can answer for me.

  • My plan for my main menu is to keep everything contained to 1 .h and 1.cpp file, is this best practice for a slate menu?
    Reviewing ShooterGame example I see they don’t do this for their menus.

  • I have no idea how to customize the look of my buttons (SButton), they are the bog standard designs and I am unable to find options to change how they look. Does anyone know how I can do this? :smiley:
    (I’m using SButton as I was unable to use the .OnClicked function on any other type of slate widget)

Hopefully the answers to these questions will help others currently trying to build a Slate menu.

Thanks,
ZeJudge

It really depends on scale of your menu. If you want to keep there like 3 buttons and a label you can keep everything in 1 file. If you want something more complex you should always go with multiple files. Note that Slate was created as a Editor UI solution and some simple in-game UI things are easier to do in HUD’s Canvas.

You can go to Content browser inside editor and create new Slate Widget Style - in this case for a button. To apply your new style you should follow code from Strategy game or Shooter game or this

What do you mean?

Right now the menu is very simple, though later I will want to make it more complex, including an options menu with various settings, save system UI etc. I’m curious as to why is it not good practice to use only 1 file?

Thanks for the info on the widget styles, I tried following ShooterGame’s widget styles before but my game kept crashing so I abandonded it. A lot of it also seemed unnecessary just to implement a style for a button - I was thinking there should be a more simpler solution for this. - I’ll take a look at the wiki post.

Cheers

The simpler solution is to wait for UMG (visual Slate) :slight_smile: Slate is a PITA to code and debug. If you need styling and widget examples, go see the SlateViewer app in the UE4 sources. Be prepared for a lot of source code digging though.

I believe szyszek is referring to if you plan to have more then one UI element ( widget ) for your main menu as best practice would be to define each widget as it own class and then in your Gamemode class that handles you menu functionality create pointers to the different UI components (widgets) you created. If you look at AShooterGame_Menu class it will show examples of this.

Dear ZeJudge,

The info you want is in SlateTypes.h


**FButtonStyle**

Find



```

/**
 * Represents the appearance of an SButton
 */
USTRUCT()
struct SLATE_API FButtonStyle : public FSlateWidgetStyle
{

```




and look at all of it

then declare your own Button Style in your .h and set its values in the .cpp and apply the style to your SButton,

and you have your own custom button appearance!

Slate

Slate is not that hard, its actually Beautifully organized internally.

It’s just not very well documented :slight_smile:
**
Everyone who wants to use Slate should know SlateTypes.h inside and out**

And then you can customize to hearts content. :slight_smile:


**Video of Rama-Style Slate**

You can see how I've played with my own Slate window and fonts and colors and background fading here:

https://youtube.com/watch?v=x40jXCy8dvk

Everything I customized was from my learnings from **SlateTypes.h**


♥

Rama

Thanks guys, I’ll take on board everything discussed here and dedicate a good amount of time doing this.

Cheers!