How to Spawn Actor from Subclass Array?

I’m trying to spawn an actor that is from a class that is a subclass array from an abstract C++ class. I have no clue how to get this to work.

header:

TArray<TSubclassOf<ABlast>> BlastTypes;

int CurrentWeapon;

source:

GetWorld()->SpawnActor<TSubclassOf<ABlast>>(BlastTypes[CurrentWeapon], Location, Rotation, SpawnInfo);

Any help is greatly appreciated!

I was able to figure it out, here’s my solution:

SpawnInfo.Owner = this;
SpawnInfo.Instigator = Instigator;

ABlast* newBlast = GetWorld()->SpawnActor<ABlast>(BlastTypes[CurrentWeapon], Location, Rotation, SpawnInfo);
1 Like

The spawn info stuff I added also, I would suggest including it just incase.