The Construction Script is actually executing anytime the Actor is placed into or moved within the Viewport. If you open the Output Log, you’ll see that it prints every time the Actor is placed in the level, and every time it is moved in the level.
It looks like this is a bug with Print String not printing to the Viewport screen when the Construction Script is executed, so I’ve entered a bug report (19924). I’ll post here when I see any update on it.
I think that Event Begin Play will work for what you are trying to do.
Construction scripts are called when the object is constructed, which can be when you place it in the level or when you call a node to spawn it in blueprints; I had the same problem until I developed a better understanding of what construction scripts were for.
There are some limits to what you can do in the Construction Script, depending on the order of creation. If you’re attempting to make changes to other Actors from the Construction Script of another Actor, you need to make sure the Actor exists first.
Can you be more specific about what you’re attempting to accomplish, and what isn’t working? The Print String example has already been explained, so I’ll need another. Thanks!
Hello, Ben.
The main issue is a ConstructionScript is not invoked for objects those placed via level editor.
I have not problems any problems with objects those was constructed from a “spawn actor from class” function.
I give a two addition reproduction sequence to make sure problem is not related with “Print String” function.
First one.
Reproduction steps:
Create a new blank project.
Create actor BP.
Call “Quit game” in ConstructionScript function.
Put actor on main scene by level editor.
!5. Make sure that actor exist in scene, but game was started. ConstructionScript was not invoked so game did not execute quit node.
Spawn actor in BP(level BP as example.)
!7. Make sure that after you have pressed play button, the game was not started because the game execute quit node.
Second one.
8. Put break point on quit node in ConstructionScript function.
!9. Make sure the breakpointed paused game only for object that was created by “spawn actor from class” function.
Do you need a third example how to reproduce the bug?
No.
Let change the title from “Event Game Begin” to “Event Race Begin” for a simply example.
Than, just ask yourself a question "Should I fill car fuel tank before a “Even Race Begin” or after “Even Race Begin”?
That’s not what the Construction Script is for. The Construction Script is executed when the the Actor is constructed, but when you Play the Actors in the level are already constructed. If you spawn it in, then it will run the Construction Script.
The Construction Script can be used for adjusting values and adding components while moved around inside the level, but this isn’t the expected place to run gameplay events, such as Quit Game.