What is the difference between construction script and event graph?

I am still a novice at blueprint scripting and these two tabs confuse me, although I have primarily been using event graph. I have heard some people say the difference is that construction script fires as soon the player character exists, while some say it fires as soon as the level starts (and by extension, when you press play), and some say that it fires when you “move an actor in the editor,” but I don’t quite follow what that means.

What is the difference between the two? The gist of it that I’m getting seems to be that construction graph immediately fires whatever script is in it when the game starts, whereas event graphing lets you assign exactly when the script fires.

1 Like

Think that is the best description for what happens when:
ActorLifecycle

Construction script is ran upon creation of the actor. The event graph is used to fire events after the construction script.

3 Likes

The construction script is mainly for modular development in editor. So for something like creating a road with guard rails and lines and a curb or a concrete barrier etc you can script all the logic for how to do this in the construction script of a spline actor. Inside the construction script you will add as many variables as you need to control all the modular and dynamic aspects of this road construction tool. Now when you drag into the world/viewport this modular tool it will likely be blank or just have one little mesh. But the beauty of the construction script when used well is that you can now “create” a road with all these little features when and where you want them to be as you drag out spline points in real time. So you start off with a spline actor that auto populates the first point with a static mesh for a road. You then drag out a second spline point and watch the construction script auto generate a second section of road. You then drag out a third spline point and once again create another section of road automatically. In addition to this third section of road, you go to the details panel and check off a few boxes (variables set up in the construction script) that allow you to add a concrete barrier or a curb or a tree, or perhaps change the static mesh material from concrete to brick etc. The construction script allows you to “construct” an actor as you go from within the editor. The event graph on the other hand allows you to say, when the player runs into the concrete wall spawn a particle system for an explosion and damage the player vehicle. Code in the event graph requires game play to run, code in the construction script simply requires an instance of the actor to be present in your level for it to run. The construction script runs before anything really happens. It does all its work before you start playing, before anything in the event graph is even started. The event graph does the exact opposite. It does nothing until you hit play.

15 Likes