I am having a brain scratcher. I am trying to populate a scroll box with with different items that shows information about the certain items. I have about 5 items in a structure, with all the information needed. But the problem is when i try to get the information from an array it populates all the lines in the scroll box with one perticular item, and when i do a random integer for the index it will populate different items but some more than once.
I can post pictures of the blueprint that i am using so far. any help would be greatly appreciated.
How are you tracking your elements? (is this an array of strings in like a RichTextBox, or separate containsers for each item)
how are you controlling the state of these elements? (if an element is removed is it outright deleted, are the elements repurposed, or are they recreated for each new use)
How often are you changing the number of elements? (does this happen on the tick(), does this happen on a Delay Loop or limited Tick, is this event driven)
are you sure that AddChild() Target=ScrollBox is only ever being called from one location?
if you put some kind of Log/Print what does the output for this look like? (if this is happening in a loop or repeatedly then be sure to have a separate output signifying the start and end for more sane analysis)
When it only ever prints out a single element multiple times:
-is it the same element each time (the first the 3rd, the last)
-you say that there are 5 items which signifies to me that there should be only elements; is there only 5, or infinite?
When you request a random index are there still the correct number of elements? (you might just be having issues with random where sometimes you do get repeats)
could you provide a sample output log of strings for what is going on (if this is supposed to be displaying like images then maybe some semi-unique string like the image names)
If I had to take stabs in the dark; I would guess you are not updating the index of what I am hoping is some kind of array, or you are not reassigning/deleting elements that are no longer being used, so they are being displayed again.
you are adding the children to a CNCMill (I am guessing this is the ScrollBox), but then when you go to “display” you are assigning the strings to Local variables in the “picker” function (where is this picker function called?)
if this SlotPicker() is called in a loop then those local variables will only ever hold the most recent thing. which can easily point to everything being repeated, and why for this example you should only see the values of your index 1.
for the Elements you are feeding into your scrollBox, give them like a struct or, members (this would probably require making these elements their own UMG object) then pass in that data directly (take a look at this https://www.youtube.com/watch?v=6CGYprd7vYU )