Button actions, I don't understand how it works

hello friends, it may seem silly, but I wanted to understand how the actions of the buttons work correctly… I currently have a menu UMG with about 20 buttons. Each button when pressed sets some variables. It turns out that this has a high consumption of ram on mobile. When I don’t add anything after the button click, the ram usage is approximately 400Mb. When I connect the sequence that sets the variables in all the buttons, I have a usage of +800MB… This makes me believe that just the fact that there is something connected to the button even if it is not pressed would be as if the engine kept it in cache or something like this. I’m a beginner, can anyone help me understand this?

UE can detect unreachable code, It’s likely that UE is stripping the unconnected code out. As for why it’s consuming so much memory, i can only say that it’s known that blueprints are very memory hungry and introduce a lot of bloat.

Try using a soft reference instead of a direct class reference (purple nodes), I think that otherwise these classes will fill up memory even if unused.

Hello, i removed the purple nodes and the ram usage has decreased a lot… But any alternative suggestions to this? What I need is when I click on a button, set a bp actor and on another level load that corresponding bp actor. Any ideas for that? Tried something like array and select but it all comes down to high ram usage :cold_sweat:

You are looking for soft pointers / references, which are paths which only load when you want them to.

2 Likes

Hello friend, after so long I came to thank you, problem solved. Thanks!