Spawn actor from string?

Hi, I am constructing a scene from a .json file. After reading the content of the .json file I am left with a string that contains the name of an actor that I would like to spawn. For example “BP_Car”. Is there a way to spawn BP_Car by only having name of the blueprint as a string? Any help is welcome :slight_smile:

Hi, there is a lot of ways you could do this.
This is how I would / did it in our current project.

  1. you could create a map with string as keys of and actor class as value and define all the actor classes you need.

OR

  1. use a “switch on spring” and define there the classes and spawn logic for each class

I hope that helps there is not a direct conversion from string to classes as far as I know.

1 Like

Thank you for the great suggestion! I am looking for something more dynamic and I think I found the solution: