Can't Spawn Actors in Construction, so now what?

I want to spawn actors for a grid that can be edited at “editor” time. Since i cannot do this at construction of the “game board” blueprint, where am i supposed to do this?

I’m having the same problem. I assume you’re not content adding components to your game board, but you wish to access each grid tile in the Editor.

Since it is possible to create actors inside a component in the construction script (this is what the Add ChildActorComponent node does), I’m wondering if it’s possible to create the actors inside a component and expose them to code that moves their outer from the containing scenecomponent to the level. I haven’t tried this myself but it’s currently where I’m at in my experimenting.

SpawnActor method is not available in the Construction script. Do you know of another way to do this?

What event would you use to trigger the spawning of these actors?

Then the actors would not be available to edit in the Editor

Well me personally would like to the option to change any properties on them like they were individually placed actors. I don’t know what joessu would like to do but I imagine it’s something similar.

Copy and paste of actors helps

So you want to make a grid? A grid of what?

I imagine you want to do it in the event graph, inside your blueprint.

a grid of actors

So you have a blueprint with the actor you want to spawn?

Then make another blueprint and get a reference to the actor you want to spawn, and then make a for loop to spawn the actors in a grid.

Yes you use construction helpers in c++ to get a reference to the blueprint and access the components.

I don’t think joessu is using c++.

Can you post a Screen shot of your blueprint?

Lets say you have an actor blueprint with a static mesh.

You can make a new blueprint, and then in the “EVENT GRAPH” spawnActor the other blueprint.

Event “Begin Play”

What do you mean edited? What do you want to do with them?

So you want to spawn a grid of meshes, and then edit the materials and location etc of each one?

Can you please explain exactly what you want to do as it is hard to guess.

So lets take a simple example.

Blueprint only I assume?


Blueprint - House
Blueprint - Factory
Blueprint - Farm

Blueprint - Town Generator
Blueprint - Spawner

Lets say, for arguments sake when I press the “1” key it spawns a bunch of buildings, randomly. I can then individually edit the houses.

Inside “Town Generator” create a function that chooses random meshes and creates an array of meshes.

Inside “Spawner” create a function for when the “1” even is fired off.

Inside each Blueprint i.e. “House” etc. Create a new function for “Onclicked” so that you can change the mesh(building type) etc.

I already did try this with procedurally generated blocks and it works.

Wait you want to do it from inside the editor only?

I don’t get it. Your not trying to make a game? Are you trying to make tools?

The answer is, you can’t spawn actors in the constructor, so you won’t be able to spawn the actors in the editor.

You need to create an editor plugin. Effectively a tool to generate villages.

Well one example would be a village where you would want to spawn a number of buildings procedurally. You want to be able to move the whole thing as a whole or quickly place a number of these at different places. After they’re placed you might want to go in and change gameplay related properties like what kind of building this is (e.g House / Factory / Farm).

Are you doing this without starting the game in the editor? If so I will definitely try this as soon as I get home.