I’m wanting to have 100s of UI elements within a frame, however only a few would be visible at once (multiple tabs + scrolling)
So I’m wanting to know what the best way to handle this is while keeping memory low. Should all items be created and cached in a table, then parented when needed? Should they be only created when needed to be visible / deleted when UI closed, which would then require recreating when opening back up again
I don’t think you should be worrying about memory usage. I’ve done some testing and found that creating a 1000 UI elements had little effect on memory usage. I tested it by creating 1000 textboxes filled with text 1000 characters long (to give them a bit more size) and parenting them to a frame. I found that before creating them GUI was using 67 MB. After creating them it took up 78 MB. its an 11 MB difference.
the only thing i could think of that would cause a memory issue is if you have a lot of images labels.
If it was a memory issue, I guess you can just reuse and reparent ui elements to avoid creating new ones.