How can I use multiple Spawn Actor from Class?


I have a Spawn Actor from Class setup and it works great.

I can place one into the world and enemies will spawn at the rate which i have set, the issue is if I fill the world the enemies can spawn outside of the walls / gaps and therefore just fall forever until the game ends… This is an issue as I need a wave based spawning system so round one can spawn x amount of enemies of a certain type and round 2 can spawn more enemies…

When i try to place 2 Spawn Actor from Class in the world the enemies ONLY spawn from the first one and not the second one… I will attach my blueprint and other relevant screenshots.

I am new with unreal so any suggestions would help.



Please check the below screenshots. Sorry for the bad writing, i was using paint :slight_smile:

Issue is very simple, you searching all spawner actors but oyu only gettign one with index 0 so only one works… not only that is binded to multiple functions in each EnemySpawner object.

You don’t need reference of object of a blueprint you are in, if object pin is not connected it should default to “self” which is object you currently in. If not there is “Self” node that returns current object you are in. So remove whole “Get All Actors Of Class” part, if you get error you need to connect something to Object pin connect “Self” node

Thank you for the reply. I am new to unreal so I am very sorry but I do not understand what you mean. Could you simplify the answer for me please. Again thank you so much for the quick reply.

on your “Enemy Spawner”
Event Beginplay → get all enemy spawner → get element 0 from array HERE IS THE ERROR
you get all spawners with (Get all actors from class…) but then you tell to just use the element 0, everytime you use this function it is returning all Enemy Spawners, for coincidence (or not, i don’t know how “get all actors from class” is implemented) the first element from the array is always the same, so the call to spawn enemy in another spawners never happens, to fix instead of all this code in “begin play” i would just use
Event BeginPlay->Set Timer By Function Name
and use “This” in the “Object” camp (so every spawner would call “spawn enemies” for itself)

edit:other guy answered first, his answer is right, very similar to what i told, i will still leave my answer just in case you think it’s easier to understand

Well it helped slightly but it still takes a lot to understand when you are new like me… Can I not adjust the BP to be able to use multiple spanners?

Could I use something such as a random int and int 1 spawns from spanner 1 and int 2 spawns from spanner 2 etc…

Or is that just over complicating things?

Again I appreciate all of this but I am struggling due to lack of experience :confused:

sure, keep the rest of the code, but instead of your “event beginplay” put mine (like in the ss i’m sending) and try again

Thank you so so much. I deleted all of the nodes in between event play and set timer… I really appreciate the help. I am sorry that I have lack of experience, I am trying to learn everything from youtube and google and it is hard when you can not find the answers you are looking for. I guess you have done this for a long time. If you want to add me on any of the following it would be great (I will not spam you don’t worry).

Skype name: tommow.major94
Steam: Tommow1994

Thank you so much :smiley:

Other guys seems to give you example :stuck_out_tongue: Are you aware that bluprints are classes? do you know what class is?

Not really :frowning:

As the other guy said, you should search about the concepts of classes and Object Oriented Programation, you can add me on steam, my Nick on steam is veccher

here is my video about basics of classes and object, blueprint is a class same as C++ class:

Problem with UE4 is that it shows classes as asset which is misleading way of showing them, they are hilarchy which oyu can see in Class Viewer. Class is just a "blueprint" of objects, a stamp for object, type of object and each object is a instance of that class and code in it is executed for each object you spawn