Why is my construction script not fully working ?,why is my construction script not working?

hi i have a problem here where if i put my construction code in a beginplay event it would work fine but when its in the construction script the code wont fully work
i tested with printing all the code work except for spawn actor for some reason !
the code works fine in begin play !
thanks for help in advance

,

You can’t spawn an actor when the game hasn’t begun yet. The construction script runs when you alter any detail in your actor, even in the viewport. You can’t expect it to spawn anything when there’s no game to spawn it into. You can do the spawning on Begin Play.

You can’t spawn actors in the construction script because it runs when an instance of that class is created or modified in the editor. So it runs when you place an actor in the level, when you move it or modify any other parameter on it and it would be quite unfortunate if it started spewing actors all over the place. :slight_smile:

It is helpful to think about the construction script as the place to get the actor ready internally for the game and for the editor (should the level designers need to work with them). That is the place to create/modify components and to calculate/store data to be used when the game begins.

you are a saint thank you

thanks man
misunderstanding from my part on how it works