Download

Widget and "clear childrens'' memory usage

here is a picture to explain the problem !

i have many widget working like this, i have a list of player connected, list of server, list of many thing… all need to be dynamically and we cant “destroy” child widget ?

Why don’t you just toggle the hearts’ visibility, rather than trying to create and destroy them. Also, are you actually having memory issues, or do you just think that there will be?

i dont have memory issue yet, but i think this can be an issue if someone play the game for a long time

so the solution is not to create children on the fly and to not use clear children, but i have to create them for one time, and keep them in a array, then collapse them when i dont want them anymore ? i have to ensure too that if there were logic ticking inside collapsed widget to stop all the logic running too

i have to rethink all my widget listing things, it would be easier to just have an option to destroy children

i probably overthink the work to do, but it seem a bit complicated to do this widget control myself instead just destroying them since i dont need to use or reuse them

It was just a suggestion, you don’t have to use it. Personally I would test your performance before worrying about it.

Re-reading your first post, you are deleting all the hearts and adding new ones every time you refresh? If you’re worried about performance that seems like a weird way to do it, when all you need to do is add or remove one heart.

i did your suggestion and its better and it work fine and not so hard to make it

my first idea to create new widget everytime was a mistake

and nice drawings you have on your website :o