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"

[Slate] Odd widget flickering when running as standalone game

I've added some placeholder UI indicators in the game. It looks fine when you choose Play In / New Window At / Default Player Start, but there's a weird flicker effect when you run it as a Standalone Game, as if it's only being rendered every other frame. Why might this be?

alt text

Product Version: Not Selected
bug_flickering.png (45.4 kB)
more ▼

asked Mar 11 '14 at 01:48 AM in Bug Reports

avatar image

ue4-archive ♦♦ STAFF
49.9k 3662 1989 9113

avatar image ue4-archive ♦♦ STAFF Mar 11 '14 at 01:48 AM

Oddly, it only seems to be in my app; it doesn't happen in the StrategyGame example.

avatar image ue4-archive ♦♦ STAFF Mar 11 '14 at 01:48 AM

Update: this seems to be related to alpha transparency. I am seeing that the flickering only happens in the areas with alpha -- UI elements that are semi-transparent flicker completely, while solid UI elements with semi-transparent outlines flicker only around their semi-transparent edges.

avatar image ue4-archive ♦♦ STAFF Mar 11 '14 at 01:48 AM +

In order to be of much help, can you provide some code that demonstrates how you have setup your UI that flickers? We don't know of any bugs related to flickering in Slate when using alpha so either you have discovered one or there is some setup problem.

avatar image ue4-archive ♦♦ STAFF Mar 11 '14 at 01:48 AM

OK -- I basically just copied the appropriate parts of the code from the way Slate is used in the StrategyGame example.

I tested various theories that this might be caused by my UI widget textures having different properties than in the StrategyGame example, or not being power-of-2 in size, but those turned out to make no difference. I also tried doing file diffs of my code vs. the corresponding files in StrategyGame but didn't find anything that could resolve the flickering.

So, here's the code. First, I have a function in my HUD called BuildWidgets() that builds the Slate UI the normal way; BuildWidgets() gets called inside DrawHUD():

 SAssignNew(MasterHUDMenuWidget, SOCMasterHUDWidget)

 if (MasterHUDMenuWidget.IsValid())

Second, I have a button class, which is literally a copied-and-pasted-and-very-slightly-modified version of SStrategyButtonWidget from StrategyGame.

I did have to slightly modify SetImage() on the button class like so, to allow rescaling:

 void SOCButton::SetImage(UTexture2D* Texture, float const scale)
     if ( scale != m_RescaleFactor)
         SetScale( scale );

     if (Texture)
         ButtonImage = TSharedPtr(new FSlateDynamicImageBrush(Texture,
         ButtonImage->ImageSize.X *= m_RescaleFactor;
         ButtonImage->ImageSize.Y *= m_RescaleFactor;
         AlphaMap = CreateAlphaMapFromTexture(Texture);


and that new CreateAlphaMapFromTexture() is derived directly from FStrategyHelpers::CreateAlphaMapFromTexture():

 TSharedPtr>  SOCButton::CreateAlphaMapFromTexture(UTexture2D* Texture)
     TSharedPtr> ResultArray;

     // create temporary hitmask
     if (Texture && Texture->GetPixelFormat() == PF_B8G8R8A8 && Texture->GetNumMips() == 1)
         const int32 HitMaskSize = Texture->GetSizeX() * Texture->GetSizeY();

         ResultArray = TSharedPtr>(new TArray());
         ResultArray->Init(255, HitMaskSize);

     return ResultArray;

Finally, I have my master HUD widget that sets up all the other stuff in its Construct(), and sets up the buttons like so:

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

1 answer: sort voted first

Have you at least tried running standalone instance without the editor running?

I encounter frame rate issues when I run standalone game and Editor at same time. And imagine there are other performance issues as well, perhaps including what you are describing.

It would provide us all with good test data if you could at least try this :)

just right click on the .uasset for your game (with editor not running) :)


more ▼

answered Mar 11 '14 at 01:48 AM

avatar image

ue4-archive ♦♦ STAFF
49.9k 3662 1989 9113

avatar image ue4-archive ♦♦ STAFF Mar 11 '14 at 01:48 AM

It's not a frame rate issue; it's a flickering issue. When I run STAT FPS, I get the same performance as I do with Play In > New Window in the editor.

And yes, I'm right-clicking on the .uproject and selecting "Launch Game" to run it.

avatar image ue4-archive ♦♦ STAFF Mar 11 '14 at 01:48 AM +

... And I'd like to believe it's something I'm doing, but it seems to be a pretty generic implementation of Slate, pulled straight from the StrategyGame example and the tutorials on the forums.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
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