Construction Script executing when a new cell is loaded (World Partition)

Hello, I’m having an issue with World Partition and the Construction Script.

From what I understand, the Construction Script is supposed to execute before the game starts and should therefore be cooked in the build. However, I’ve noticed that with World Partition, when I play and load a cell, the Construction Script of my blueprints runs again, which causes several problems:

  1. It can cause stuttering if the Construction Scripts are heavy.
  2. If I significantly increase my loading zone size, the game crashes with an infinite loop construction script executing.

How can I make sure my Construction Scripts only run before launching the game in the editor and not when I play?

1 Like

To ensure your Construction Scripts only run before the game starts in the editor and not during play with World Partition, use the “Has Authority” node to control execution based on the server or client. Wrap editor-only logic with the WITH_EDITOR directive to prevent execution during runtime. Alternatively, trigger the Construction Script manually during initialization. Also, optimize the script to reduce stuttering and avoid heavy calculations during cell loading.

Hello, thank you for your response. I tried using “Switch has authority” (I’m making a single-player game, so I’m not sure if it has any effect) and also “with editor.” It seems that the construction scripts still execute when the World Partition cell is loaded… :frowning:

What exactly do you think onCreate means?

And why would you not expect it to run when you spawn something in?

Use a proper function call instead of hacking togeter with stuff you shouldn’t be messing with.