How to spawn actors from blueprint in C++?

Hello.
I’m trying to make a shooting mechanic in C++ and I have no idea how to spawn an actor from blueprint in my Player Class.

Can you help me?

Thank you very much

Thanks for your help

To add onto what S-ed wrote above, Lauren Ridge has a C++ tutorial on how to make a battery collector game and in it there is a video on spawning volumes. This might help… C++ Battery Collector: Introduction | 01 | v4.9 Tutorial Series | Unreal Engine - YouTube

Actually, I have a problem.
This tutorial really helped me, but I want to spawn an actor from blueprint and from this I can only understand how to spawn it from a C++ class.
What should I replace to spawn it from blueprint?

@teak421 Nice. I didn’t know they’ve updater the tutorial. It one one of the best but code was incompatible with new ue4.

@J0K3R_12QQ Maan. Use search (it’s on the top of the page)

Has the SpawnActor stuff changed since that tutorial? @s-ed

I don’t know. The one @teak421 linked is newer. Old one was like back in 2014. And it didn’t work since many changes in source were made.

I wonder if Epic should just remove the old tutorials because it just confuses people…??

Some people may use old version of engine.

Epic just should add some info or link to newer versions. But they’re really busy, there’s not much people working on web content.

You need UClass pointer of blueprint class to use it with SpawnActor,

In C++ you can get UClass pointer of any class via static function StaticClass(). It impossible to get blueprint UClass like that because blueprints don’t exist in compile time, you need to get UClass in runtime. You either do that with FClassFinder in constructor (it only works there), here example of it with widget blueprint (you can get path by right clicking asset and using “Copy Refrence”):

or there a lot simpler solution, make UClass* varable or TSubclassOf editable in property editor and then set in there, property editor will show both C++ and Bluepritn classes to choose. For example you make class which spawn something, you can make property which decides what it spawns.