4.8 P4 Construction Script BP and C++ not firing

I was first testing this by using a PrintString in the construction script but saw that this may not be a valid test so I did the following. Created a new BP with an arrow component. In the construction script I set the arrow to a random color.

When I drag and move around the arrow in the editor it will change colors flawlessly. However, when I hit play the arrow color stays the same.

I first noticed this w/my C++ actors. They are all invisible when playing so I’m hoping this is related.

Long time user/tester,
-jeff

Hi jeffvoigt,

From what you are describing, construction script is working correctly. Construction Script is something that is called whenever the object is constructed or placed in the scene. The fact of it changing colors when you move it in the viewport is a good sign that it is doing what it is supposed to. The thing that is different is that construction script is not called at runtime. The event that you would want for this would be OnBeginPlay() or the On Begin Play node in blueprints. This is something that is run as soon as the game starts, but will never be reflected beforehand.

I hope this helps!

Matthew Clark

And the same is true for blueprints? The construction script is only run in the editor and basically all objects in the editor are saved and copied and therefore not “reconstructed” via that construction script?

Just to be clear I am not referring to an objects constructor in C++ but rather the event.

That is correct. The construction script works exactly like a constructor in C++. The construction of the object is run every time that object is added or edited in the editor, but is never run at/during runtime.

Thank you!

No problem, please let us know if you need any more assistance. I’ll be moving this question to ‘Using UE4’ due to the nature of the post.