Download

Cannot modify widgets stored in array?

I have a simple function “GetButtons”, which creates a new array, populates it with children of a specific type and returns it:

In another function, I call “GetButtons”, iterate through all elements and change their visibility:

I can set a break point at the “Set Visibility” node, and the break point does get hit, however it doesn’t actually seem to be doing anything as the button’s visibility doesn’t change.

However, if I remove the call to “GetButtons” and copy its code, but instead of using an array I apply the visibility directly, it works perfectly fine:

I’m stumped, what’s going on here? Why does it simply refuse to work when I’m working with arrays? The code for the case where it’s working as intended is exactly the same as “GetButtons”, minus the array.

I don’t think you can use Make Array node this way, you’re not adding anything here. Print text the length of the array spat out by the function and it will most likely be 0 or 1 but with a null reference.

Instead, create a local variable of the desired type and return this instead. You may not even need casting here; that’s unless you need something more specific than visibility.