Spawning Child Class Actors

Anyone know why this isn’t working in my level blueprint?

-I have 5 child classes that inherit from 1 parent.
-I created an array of type, parent class and filled it with the child classes.
-Nothing spawns in this configuration.

If I choose a child class manually in the Spawn node (no array input) the actors of that child class spawn just fine. Am i using the wrong array type? Can’t seem to figure out what’s going on.

Add a print-to-screen node that prints the location and type of each actor spawned (use the output of the spawn actor node.)

Look in the output log to see whether there are error messages.

Are you sure there are target points in the level?

If you set a breakpoint on the “spawn actor” node, and start the game, and then hover over the “class” input, what does it say the picked class is?

There are 16 target points that spawn just fine if I directly put a child class into the “Spawn Actor” node so I know that functionality is ok.

Seems like my classes are NULL even though I made them type “Class Reference”. I am getting this error in Output “Warning: UGameplayStatics::BeginDeferredActorSpawnFromClass: can not spawn an actor from a NULL class”. It happens for each iteration of the loop, so this is most likely the culprit.

Here are my variable declarations not sure why they are NULL however. Any thoughts?

Turns out I didn’t set the default values in the details section for the class references, now it’s working. Didn’t realize that was something I needed to do with class references, learn something new

The reason for this is that a class reference just says “this is a reference to some class that is a subclass of X.”
It doesn’t know which particular subclass you intend. It doesn’t even know that you don’t have subclasses of those specific classes :slight_smile: