Array loses entries

Hello there,

I am currently working on a system which allows to switch through different widget children of an array. By pressing left or right I am able to switch to the widget with value one less/more than the current widget. I also implemented some logic so that when reaching the outer limits it would loop back to the opposite side.

Here is the logic for switching

This is how the array looks most of the time

This works fine for the most part. I can go fully from left to right without any issues but once I try to go left I get stuck at the maximum value, in this case the array value 5. After doing a little debugging I found out that my array loses the widgets number 4 and replaces it with number 5. Creating an infinite loop where number 5 always calls number 5.

I cant find what tempers with the array since I dont ever modify parts of it, I only feed it integers to get the children with the given value.

Maybe one of you has an idea whats going on here?

There’s nothing in the script we see here that could be causing it. The issue is where you tamper with it, where cannot see :innocent:

After doing a little debugging I found out that my array loses the widgets number 4 and replaces it with number 5. Creating an infinite loop where number 5 always calls number 5.

All we can see is that you had 6 elements, and now you have 5. :person_shrugging:


  • how do you populate the array?
  • does it have default value?
  • do you Add / Remove or Set Array Elements anywhere?
  • search for that array in all blueprints

image

  1. The Array is populated manually in the editor
    image

  2. I dont add remove or set array elemtns only get.

Sorry wrong array
image

The first one is the real blueprint this is the test version that I am using with less functions

When searching for the Array in all Blueprints it only gives me the two times I use it in this blueprint. THe one that you can already see and this

What do you get if you:

Does the length change?


And just to clarify:

You’re asking about why the array size changes from 6 to 5 elements, right?

Corect, I am investigating the change in size. Unfortunately following your example the length doesnt get printed at all. I will try a different construction to test the length

So with a different construction I can now read the length. Going right the length stays at 6 always, going left when reaching the last index the length goes to 5

There’s nothing in this script that could affect the length of that array. Set up break points and step through the script, see what you can find out.


Alternatively, try this instead:

This would cycle through all the widgets with a two-way rollover. I’ve ignored the fact that the widgets are never removed and just keep overlapping infinitely.

Your idea seems to be creating some issues in my system.

FYO: I am already setting the widget number in before the game starts if that changes anything

Okay I fixed the issue mine head.

2 things:

  1. Its the wrong way but that doesnt really matter

  2. The same issue occurs once again

Same issue

Compare yours to mine.

It should be the the other way round, pin order. Or use another Select node (thank Epic for this inconsistency :innocent: ).


Which would indicate that you must search for the cause elsewhere. I don’t think this script is related.

I will look if I can find an issue eleswhere. Its just weird to me that there arent any outside factors coming in and it still doesnt work.

1 Like

In order to get rid of widget 4, you’d need to explicitly remove that index.

image

If you don’t, and the array is not accessed anywhere else, chances are you’ve run into an unorthodox bug no one has ever heard about. It’s definitely not impossible.

If you ever figure out what is causing it, do tell!


For now, perhaps make a new array variable and see if the issue still manifests.

I will update if I can find anything. But it seems to be replicable as at home I ahve a similar system which encounters the same issue

So it turns out if I just create a new Array with the same indexes it works.

Its strange but I guess it works now. I had a similar situation when i ahd a specific widget not working. Deleting it and recreating an identical one fixed the issue.

Strange things happen sometimes

1 Like

I just hope the problem doesnt just reoccure randomly

Okay no, after restarting unreal its broken again

I think I found the issue. Its the name of the array. Renaming it to “NewVar” or something lese like “Widgets” fixes it even after a restart

1 Like