Construction script called 5 times when compiled?

Is it normal for a construction script to get called multiple times when you press compile on the script?

I was getting some odd behavior as I was working on a script and finally tracked it down to the construction script getting called multiple times when it was being recompiled.

I tested this out on an empty blueprint and confirmed that a blank blueprint with a single print string in it will fire 5 times on recompile.

Cheers,

ook

1 Like

Did you ever figure out the answer to this? I noticed it gets called 5 times too which is odd.
Thanks

No I never resolved this. I just ended up removing the offending construction code since it was causing crashes. At some point it would be awesome to get an accurate description of exactly what events cause the construction script to be called.

I face the same behavior, it’s really hard to debug that construction script because of multiple initializations. Have anyone figured out what’s the matter of running thing that is supposed to run once several times instead?

So I was puzzled at this today and the reason this happens seems to be what we have open and whats in the world.

You can see this yourself if you attach a print string node to your construction script.

Simulate blueprint → 1 call.
Compile blueprint → 2 calls.
Compile with blueprint instance in the world → 4 calls

Looked further and another user came to the same conclusion: https://answers.unrealengine.com/questions/484183/construction-script-runs-twice.html

It’s not a bug. It’s a feature!

Someonecan explain why and how this works, I have exactly the same “problem”.
When I put a actor into the lvl and make a print string at the beginning of the construction script, the string is printed 3 times and compiling. Why is that? I would assume construction script is run ones?
I also have only one of the actors in level. Also, I print out the actor name and if “is server”, but all is the same in all three construction skript runs. So, why on compile construction script is runnung multiple times for the same actor?

Interesting, but did you ever found out why this is and what is the purpose of this?

I do not understand the reason behind this. I would assume construction script is run ones. Also when one actor is in the level.

Just had this issue when trying dungeon generation in blueprints, turns out you have to click the ‘Simulation’ button if you want it to only run once.

UE 5.4.4 at 2024 and this bug persists…