Problem with a custom function and Construction script

Hi, I have set a Construction script in a Blueprint class that calls a custom function that should spawn some actors from another Blueprint class (calling “Spawn Actor From Class” in the custom function, I would like to do it directly in the Construction script but it’s not possible). The Blueprint actors to spawn have a visible static mesh components and work right when placed directly in the level.

However, the Blueprint that has to spawn many actors of the other Blueprint class is not spawning them. Do you know what could be the cause or how to solve it?

#Dont Spawn in Constructor

Doing complex game logic that affects the rest of the world is not recommended for the constructor script

you should do your spawning in the main graph :slight_smile:

Constructor script should be for things internal to that particular object

Rama

Hi Rama, thanks for advising. I’ve tried another structure within the main graph, however it doesn’t work and the log doesn’t mention any warnings.

Do you know what might be preventing the spawns? Don’t focus on the overlap bool, it happens the same if ticked.

If calling a “Add StaticMeshComponent” insted of that Spawn Actor from Class it spawns it as expected. It also fails to spawn other blueprints.

#You are Spawning at Origin

In most levels the origin is the kill Z, which means actors are destroyed that spawn there

Try using a default Z value of 1024

and look up :slight_smile:

Rama

Thanks, I hadn’t noticed that I had lost a vector at some time during the process. Now it works great with the graph in the image.