Ok, I posted my original problem here but I have made some progress. However, it seems to me Unreal can’t do this at all, but I try.
I have the following code which returns a UBlueprint:
UObject* ClassPackage = ANY_PACKAGE;
UObject *l_Object = LoadObject<UObject>( NULL, TEXT( "/Game/Client/Characters/Blueprints/DesignCharacters/DesignChar" ), NULL, LOAD_None, NULL );
UClass* u = l_Object->GetClass();
“DesignChar” is a blueprint I created in UE which is a blueprint based on Character.
Now, the above code returns “UBlueprint” as class, although, when I look into those objects with the VS Debugger, the correct name of the blueprint is inside the objects in some class variables, so it clearly knows the name of the original class.
I need an actor reference to be able to spawn an actor in bluprint with the SpawnActor node. I can return the class extracted above and then use the CastToActor node in BP but that cast always fails.
I assume it is because UBlueprint and AActor are not related in the C++ hierarchie. The SDK reference states that these classes have UObject as the lowest common baseclass, so they are clearly in different branches of the derivation tree.
How can I get the AActor reference from a Blueprint?
I think that the Unreal Documentation is very misleading when it comes to blueprint. It uses the term “class” indiscriminantely fro blueprints or any elements in the editor, when they clearly have nothing to do with classes.
For instance it says that a new blueprint can be “derived” from Character which is derived from Pawn which is derived from Actor. But a look into the C++ documentation shows that this is clearly not true because Actor and blueprint are not related.
So I assume what Blueprint calls “derived from” is bascially some meta data melange of data that gives the illusion of a derivation, when in fact it is not.
so my question is now: How do I arrive at an AACtor reference from a UBlueprint. There must be a way to create this translation through the Unreal meta class system, I just don’t know how