Some arrays in construction scripts do not clear automatically in 4.23

Hi,

I just ported my project to 4.23 and suddenly some construction scripts stopped working. After some troubleshooting I was able to figure out that some specific arrays no longer clear automatically each time construction script runs. They now require to be manually cleared. This is quite confusing since it is not consistent, as some arrays clear while others don’t.

Here’s a very simple example:


This is a small function that runs in the construction script, it adds HISM component, adds it to an array and prints the array length.

In 4.22, every time I touch the blueprint actor, construction script resets all data and re-runs:

The exact same construction script in 4.23 accumulates those HISMs in the array, without clearing it automatically:


Is this a bug or some new feature of 4.23 I need to look out for? If it’s a feature, which rule defines if the construction script clears specific array or not before it’s called again?

Thanks in advance.

I’ve had a somewhat similar issue after converting my project from 4.22 to 4.23.

Not really sure if its an engine bug, but every time the construction script runs in the editor, it kept retaining references to spline components (added dynamically) created in the past, and more kept getting added every time.

You can check if it’s the same issue with your HISM components by printing out the component names from the array in the editor. The ones that should have been deleted had the ‘TRASH’ keyword in my project.

In any case, I ended up fixing it by clearing the array at the start of the construction script.

I’m seeing the same issue and had to force the arrays to clear as Stormrage256 describes.

Yes, same here, getting the trash ones. This is quite confusing because now I am left guessing which arrays need to be cleared manually and which don’t :expressionless: The fix is obviously not a big deal, but if it remains this way we will not be working in a minefield of arrays, not knowing which ones we have to clear and which not.

@Rawalanche @thejturner I did some further tests on that. So basically the issue seems to be affecting only arrays that hold references to components (both actor & scene components) that were added in the construction script.

If the array is of a primitive data type like an int array, everything works just like we’d expect it to. No need to clear the array every single time. The same applies to arrays containing references to Objects created using the Construct Object from Class nodes. So we might be dealing with an engine bug here.

I already reported it as one. Let’s see what happens :slight_smile: