Why is this construction script executing twice?
Alright, what I'm trying to do is use a blueprint construction script to spawn a number of other blueprints as child actors. Specifically, I'm making a simple breakout/arkanoid clone for practice. I have a Brick blueprint that contains some basic logic to spawn an effect and destroy itself when hit, and a BrickField blueprint that spawns a number of Bricks as child actors according to settable variables in ordered rows and columns.
Now, the problem is: if I spawn these child actors in the construction script, they seem to be spawned twice, as can be seen in the Scene Outliner window and by the fact that there are flickering colors. If I move the exact same network of nodes from the construction script to an Event Begin Play node in the regular EventGraph, they only spawn once.
Here's the script: (Full size)
As I said, if I take that exact network, copy it, and attach it to an Event Begin Play node, it works as intended.
Here are the assets and blueprints in question: http://stuff.pyrron.com/BrickField-Bug.rar
Does anyone know what's wrong with that? Is it an engine/editor bug, or is it a problem with my blueprint? Any help would be appreciated.
Edited to add: The spawn actor from class node in the Brick blueprint just spawns a particle effect, just delete it or assign a random one if you're getting compile errors.
I had a similar problem in my Game Mode blueprint. It was executing the Construction Script twice and the Begin Play event three times, even if the only thing I had hooked up to them was a Print String. What fixed it for me was finding that there were actually 3 different Game Mode blueprints in my Content folder, even though it showed that there was only one in the Content Browser. I think what happened was Unreal Engine was creating hidden copies of the blueprint whenever I would copy and rename the blueprint from within the Content Browser. I just deleted the extraneous blueprints and it started running just once again. Hope that helps.
answered May 16 '14 at 05:37 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here