I got an blueprint UMG with a blank scroll box.
In my game, sometime, there will have text appearing in that scroll box by “create widget” and “add child” (to the scroll box).
Its working but,
I want each next new created widget to be add to the top of the list.
Like a facebook page news feed
i tried with an array and insert but i wasn’t able
Make a “placeholder array” and have array index 0 as your new entry.
Run a for loop that feeds each index of your original array into the “add array element function” (or whatever the the equivalent is called in blueprints).
Clear your original array.
Feed your placeholder array into your original array.
my scroll box is showing my array of text
I used “insert array” and “add array” to try to sorting my new feed with integers.
like 1 on top and -1 to new feed created.
I think you misunderstand my suggestion. Try rereading the thing step by step.
And you cant “insert” an index at -1. Arrays start at index 0 and go from there. I highly recommend you google arrays and/or “zero-based index” to get an understanding of how they work.
I don’t think you can directly insert a child widget into a *scrollbox *at index 0. I would not insert messages into an array either or keep a dummy. Keep the array with the text as is; but rather than looping from index 0, loop from the last element to the first one and create widgets as you go. This way, your last array index will be the first *scrollbox *child.
There’s a caveat here, you will need to clear and repopulate the entire scroll box when adding another child. If you want to keep thousands of entries there, consider handling the last couple of dozens only.