UMG/Widget decreasing FPS?

Hi!

I have a very annoying issue, when I use widget my frame rate drastically decreasing! From 120 to 3 FPS…someone mayby tell me why? I have enough of it. Please help!

What exactly are you doing inside of it?

A simple 2d widget itself does hardly affect the framerate at all. I didn’t had a chance to test the 3d once but I can not imagine it having such an impact either.

Could you explain a bit further how you set it up?

Like how you spawn it and what it does. Ideally with pictures.

Cheers

Hi Erasio

This is a link to my Unreal Project -

Simple scene and simple widget. But my fps slowing down very quickly from 120 to 0.13? I not have a clue why… Please help

Oh yea I see.

“Event Receive Draw HUD” is an event which will be called each frame.

You draw the texture and then (remember still each single frame) create a widget and add it to the viewport. That means in the beginning you spawn 120 widgets per second. Each one will be rendered each frame. You see where this is going right?

For this you could for example use “Event Begin play” which will be called only once at the beginning.

I hope this helps.

Cheers

Now It works flawless! Thanks Erasio you saved my life!
But I’ve one more question… I try to setup a inventory - scrollbox with item boxes, I’ve done whole blueprint (one for scrollbox, one for button and I use a Froeachloop to add a child to scrollbox, but when I try “event begin play” its don’t display anything on screen… Do you have any ideas?

Cheers!

Where do you call your “Event Begin play”?

Inside of a widget you would want to use “Event construct”.

Could you upload a picture of what exactly you’re talking about? It’s a bit hard to guess in which bp you have all of this and what exactly you did :wink:

Like I said two widget, one for scrollbox and one for itembox. In scrollbox blueprint I create a function to add a item box. At least I use a “event begin play” and nothing display on screen, but when I plug this to “event recieve draw HUD” its working but like you said its isnt a correct way to do this.

First of all you don’t have to cast your widget to the specific one. You can put the output of your “Create widget” directly into “Add to Viewport”.

And is it really working with “Draw HUD” like you’d expect? The only explanation I have for this is that you don’t update the slots and the inventory you’re referencing is empty when event begin play is called…

Okey, thats make a sense… but how can I update my widget? I was trying but nothing seems to be properly.

If you want to modify the widget you will have to store a reference after you created it and work with that.

Or do everything inside of your widget. You could add the buttons to an array and check each tick if something changed in the character and then add / remove something if something has changed.

There are a couple of different approaches and especially in your very first projects you will find a dozen things which you would do better or different after you’ve worked quite a bit with the engine. You should just try what you think should work right now and then try to figure out why it doesn’t. You’re actually learning a whole lot from that :wink:

I’ve done some tests and now I clearly know what is wrong. Whole function in widget is good but function in my pickup system is wrong, because don’t update the viewport when I pickup some item. Thats why I dont see nothing in my scrollbox. I must refine/rebulid my pickup function.

Cheers

lol I had the same problem with 4.13. And all the versions. Try to use Text Render components instead of UMG. That should make the things a lot better. Good luck!
~Michael