Download

Efficiency Question

So i’m making an inventory system and had a question on what would be more efficient for a mobile game.

The inventory is a simple hotbar like in minecraft, but it expands based on how many items are in the inventory.

My question is, should i set it up to dynamically create or destroy inventory boxes so that there is always one more box then there are items, or should I just add and hide a few more boxes than i could possibly need?

this is being done in Blueprint, if that changes anything.

Hi [USER=“3136594”]Random Paladin[/USER] ,
i would suggest you to create them dynamically , i think is less waste (even if really little).

I link you a great answer i got when i asked how manage a great number of buttons, dynamicly created and event-linked!

Depends on what you want it to look like, you could always start with no boxes/slots and just create them as needed.

So lets say you start with nothing. Once you pick something up, you create a slot. If you drop all items from the same slot, then delete that slot. This way you always have only as much as you need.

When you pick up an item, you check if there are any empty slots (if a new slot is required and won’t just stack), if not, you create a new slot and then add the items to it. This will reduce the amount of widgets you have open at one time. But for a smalll inventory it’s probably not going to matter much.