Designating a "spawning area?"

Hi :slight_smile:

Is there any type of actor I can use that acts as a spawning area? I want to designate a set of coordinates as an area where certain actors spawn, rather than “hard coding” the coordinates in a blueprint. This way, I could move the spawning area freely in the editor, and the blueprint would point to the location of the spawn area actor rather than typed coordinates.


I’m pretty new here, but my recommendation would be to create your own Blueprint/C++ class for a spawn point, and then use the “Get All Actors of Class” function to get an array of all instances of that class in your level. You can then pick a single instance like this:

Thanks, but I don’t think that’s what I’m looking for. That seems to be more like individual spawn points across the map from which you could choose from. What I’m looking for is something like this:

Please forgive my art, LOL. Anyway, the enemies could spawn at any random point within that box. I would use a blueprint to have enemies spawn within the coordinates contained inside that box, the spawning area. I could move that box in the editor that way I don’t have to “hard code” the set of coordinates in the blueprint, but instead reference the spawning area.

Don’t know if this is still an issue, but I thought I’d post an answer here just in case other people are looking for a similar solution.

Create a new Blueprint class and add a cube static mesh to it. Let’s say that you are using a StaticMeshComponent (a Cube for example) to represent the spawning area - this is what you’d add to the Blueprint’s Viewport. Set your Cube’s properties as “Actor Hidden In Game” and set its collision to “NoCollision” so that it doesn’t actually interfere with gameplay. You can position and scale this however you want in the editor after placing an instance.

In the simplest case, let’s say you want the enemies to spawn as soon as the game starts (but you could also use EventActorBeginOverlap). You then get a reference to the cube mesh you created off the EventBeginPlay, Get the component bounds using “GetComponentBounds”. Use the Origin and BoxExtent pins and attach them to “RandomPointInBoundingBox”. Use the ReturnValue from that to the location of a “MakeTransform”, and the wire up the ReturnValue from the “MakeTransform” up to a SpawnActorFromClass, specifying your enemy actor as the class (I’m just spawning point lights here so the Blueprint would compile).

Did you ever figure this out?

It sounds to me like you might moreover be wanting to create a bounds that spawns to control the playable area for you and your enemies. Is that what you meant?I think?

Take a look at this How can I randomize a playable level area? - Blueprint - Unreal Engine Forums as I am kinda trying to figure out how to do something similar.

yea that was awhile ago but i believe the asker was just looking to spawn enemies at random locations within a volume. its actually a rather simple task, you just have a collision volume or trigger volume then get its bounds (origin & extent) then use a get random point in bounds. example provided below.