Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

[UMG] [SLATE] Setting default slate style in umg class

I am trying to set a default widget style for my custom UMG class. I have already created all the accompanying Slate classes, and have successfully setup my project to use custom styles. I have closely followed some of the available Slate classes and their corresponding UMG classes and through there, I came to the following solution;

The constructor for Mywidget.cpp

     UBK_UIWidget_ItemboxSimple::UBK_UIWidget_ItemboxSimple(const FObjectInitializer& ObjectInitializer)
         : Super(ObjectInitializer)
         SBK_UIWidget_ItemboxSimple::FArguments DefaultItemBox;
         WidgetStyle = *DefaultItemBox._ItemboxStyle;

and the corresponding FArguments part of the slate class

     class SBK_UIWidget_ItemboxSimple : public SCompoundWidget
             : _Content()
             , _BackgroundImage(GetIcon())
             , _BackgroundColorAndOpacity(FLinearColor::White)
             , _BackgroundPadding(FMargin(10.f, 10.f, 0.f, 0.f))
             , _AmmoImage(GetIcon())
             , _AmmoColorAndOpacity(FLinearColor::White)
             , _AmmoPadding(FMargin(0.f, 0.f, 0.f, 0.f))
             , _ItemboxStyle(&FBK_SlateStyles::Get().GetWidgetStyle< FItemboxSimpleStyle >("ItemboxSimple"))
             , _NoOpacity(FLinearColor(0.f, 0.f, 0.f, 0.f))
             SLATE_DEFAULT_SLOT(FArguments, Content)
             SLATE_ATTRIBUTE(const FSlateBrush*, BackgroundImage)
             SLATE_ATTRIBUTE(FSlateColor, BackgroundColorAndOpacity)
             SLATE_ATTRIBUTE(FMargin, BackgroundPadding)
             SLATE_ATTRIBUTE(const FSlateBrush*, AmmoImage)
             SLATE_ATTRIBUTE(FSlateColor, AmmoColorAndOpacity)
             SLATE_ATTRIBUTE(FMargin, AmmoPadding)
             SLATE_STYLE_ARGUMENT(FItemboxSimpleStyle, ItemboxStyle)
             SLATE_ATTRIBUTE(FSlateColor, NoOpacity)

Whenever I implement it like this, it just crashes the editor right away without fail. I have closely studied the SButton and Button classes, but while for the Button this implementation works, it doesn't for mine. Anyone knows how I can set the default widget style, so I get to see the defaults for this style whenever I use this UMG class?

Product Version: UE 4.9 Preview
more ▼

asked Aug 22 '15 at 08:03 AM in C++ Programming

avatar image

815 30 26 105

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question