If I use looping “Set Timer by Event” in a widget blueprint then remove that widget from parent, it never gets destroyed. After creating and removing this kind of widget from parent hundreds of times causes significant fps decrease. Because there are hundreds of instance of that widget and they don’t get destroyed.
Expected: Widget should be destroyed after it is not being called by another actor for a period.
Result: It is never being destroyed and never stops working so it is causing low fps on mobile devices if there is an expensive operations in the timers custom event.
–Here is longer version of this bug report:–
I have a widget with a looping timer. Every 5 seconds, it is refreshing it’s content which is a little bit slow operation. But, even if I remove this widget from parent, this timer never stops. If a create this widget 100 times and remove all of them from parent, they continue to working and in mobile device fps extremely decreases.
To reproduce:
-
Create a widget blueprint. Name it “MySlowWidget”
-
Set a looping “Timer by event”. Write 5 into seconds input.
-
In the custom event of the timer, do iterating very expensive operations that can slow down a mobile device.
-
Create “Close” button in this widget that removes this widget from parent.
-
Implement a way to execute “Create MySlowWidget->Add to Viewport”. For example implement this to “Anroid Back” button in your player controller class.
-
Package the game in development mode to the slowest android device that you can find.
-
Press “Anroid Back” button to create the widget.
-
Observe fps. It should be decreasing when timer is calling the event. If fps is not decreasing, go back to step 3 and use more expensive functions it the event that is called by timer. If you are able to see fps decrease, continue to next step(9).
-
Remove created widget from parent by tapping the close button, which you created in step 4.
-
Recreate widget with “Android Back” button.
-
Do 9th and 10th steps tens of times.
-
Close the widget if it is not and now observe fps.
Expected: No significant performance decrease
Result: Fps is around 10