How to get class from actor blueprint?

I have created a blueprint that is meant to be able to spawn actors from a dynamic set of blueprints, and the spawn actor from class function requires a class to be passed in to spawn an actor, how can I get the class from a blueprint I have created and pass that class into the spawn actor function?

Basically I want to be able to have logic to select a blueprint (or class) and spawn that as an actor from the blueprint script.

Some from my understanding you got set of blueprint classes (since blueprint is practically a class as same as coded in C++) and one class that select one of those classes and spawn them.

I can’t find block which would grab asset form content browser, but C++ has APIs for that so you could try to use that if you got skill. Alternatively, you could create array of classes and select classes from that array.

I am aware I could do it in C++, I’m sure many things are possible through C++ that go beyond the blueprint system, however, I want to try to exclusively use the blueprint system.

To your second point about the array of classes, the problem still remains of how to extract the class from a blueprint within a blueprint event graph.

I’m not sure you need to extract it, you can spawn bluebrints, they are really classes, which the _c tacked to the end of their name kind of indicates. I have used the SpawnActor node and in the selection box dropdown my blueprints that do extend from Actor in some way are there.

As for looping through the list of them. I’m not 100% sure, but have you looked at the Blueprint LibraryAsset?

This is my event graph and I want to add a switch statement to select between different blueprints and spawn actors based on that.

You mean class of a blueprint that graph is in?

then “Get a reference to self” → Get Class → Do stuff

In general “Get Class” will extract class from any object whatever you want to do :slight_smile:

Ahhhh then maybe you searching for “Switch on…” :slight_smile:

the programming concept of a switch which is a selector between any number of case statements.