For Each Loop in Function | Construction Script Bug

Bug Replication:

  1. Make an Array of Static Meshes
  2. Create a Function and call it from the Construction Script
  3. Inside the Function create a For Each Loop base on the Static Mesh Array
  4. Add Static Mesh Component based on the Array of Meshes
    Result: The Construction script will spawn only the 1st Static Mesh of the array and the for each loop will be interrupted
    Workaround: If you don’t place the for each loop inside the function but do the same directly in the construction script blueprint it will work perfectly and all the meshes from the array will be spawned

Can you show the function? ( I think it’s short circuiting, which is what functions are supposed to do ).

Construction script


This is the function called 3 times in construction script

You need to break the struct from here