OnConstruction called before BeginPlay or after?

Hi, I am trying to rotate the spawned items using OnStruction after they spawned on using BeginPlay.
But the Items are not rotating.

Under OnConstruction.
Under BeginPlay.

What I am doing wrong?

OnConstruction() is called before, and even when you’re in editor, not in the game. After the game starts, OnConstruction() does not execute anymore.


Thank You for your time to reply.
So its means I need to spawn and rotate using BeginPlay?

if yes… for which purpose we need the constructor OnConstruct? this constructor directly means that when On Construct object we must be able to transform or change any property of it. But it seems to me this is not for this purpose.

OnConstruction() is the same as Construction Script in Blueprints.
Use it if you want to make changes in the editor and see them immediately. Like if you want to make a spline mesh, or stairs with custom number of steps, or turn lights on/off, or a lot of other things. It all can be done on BeginPlay(), but you want to see the effect while in the editor for convenience.
Note that every variable you change under OnConstruction() in c++ must be a UPROPERTY(), or it will be back to default value on BeginPlay();


This solved the issue, now I can transform the items using OnConstruct(); thank You for the perfect explanation, was very easy to understand :smiley: