Getting an AActor like version of my blueprint to C++

So I am working on a class in c++ which should be spawning my enemies in the map on specified spawnpoint, but they only spawn whitin a certain range of the player and spawnpoints closer to the player spawn more enemies. I have a prototpe version in Blueprints, but I need to optimize it and upgrade it in C++. However this is the first time for me of programming C++ with Unreal Engine (I have programmed a bit in other langauges such as html, php, javascript, python, C++ and C++ whith a different compiler for the Arduino). My main problem is that my player is a __ blueprint __ character which inherits from another __ blueprint __, so reparenting isn’t really an option since I will have to rewrite multiple blueprints. So to tackle this problem I want to be able to get the class of my __ blueprint __ so I can use get all actors of class and for each on it (in the C++ way of course).
So if I could just make it like where I have AMyClass that would be perfect, but I have no idea how to achieve this, or if it is even possible.

I have looked on the internet for a few hours now but nothing realy helped me.

Any help would be greatly appreciated.

Thanks in advance,

There is an undocumented function StaticLoadClass, it can get UClass from your .uasset. Here’s a similar question.

Add postfix “_C” to the filepath, it should look like this:

TEXT("/Game/FirstPersonBP/Blueprints/FirstPersonCharacter.FirstPersonCharacter_C")

Unfortunately the first argument is misinterpreted in the question I linked, it has to be the base class of a class you are trying to get, not of UClass. If you look at this method’s source code, you’ll see this check:

if( Class && !Class->IsChildOf(BaseClass) )

All in all, this example will work, I checked:

UClass* Clazz = StaticLoadClass(UObject::StaticClass(), NULL, TEXT("/Game/YourBPClass.YourBPClass_C"), NULL, LOAD_None, NULL);

The following lines all compile but none succeed to load the class:

UClass* PlayerBP = StaticLoadClass(UBlueprint::StaticClass(), NULL, TEXT("/Game/FirstPersonBP/Blueprints/FirstPersonCharacter.FirstPersonCharacter"), NULL, LOAD_None, NULL);

UClass* PlayerBP = StaticLoadClass(UClass::StaticClass(), NULL, TEXT("/Game/FirstPersonBP/Blueprints/FirstPersonCharacter.FirstPersonCharacter"), NULL, LOAD_None, NULL);

UClass* PlayerBP = StaticLoadClass(UBlueprint::StaticClass(), NULL, TEXT("Blueprint'/Game/FirstPersonBP/Blueprints/FirstPersonCharacter.FirstPersonCharacter'"), NULL, LOAD_None, NULL);

UClass* PlayerBP = StaticLoadClass(UClass::StaticClass(), NULL, TEXT("Blueprint'/Game/FirstPersonBP/Blueprints/FirstPersonCharacter.FirstPersonCharacter'"), NULL, LOAD_None, NULL);

Am I doing something wrong?

Someone give this man an oscar XD
thank you so much!