in my current project I need a way to in C++ either
a) find all classes inheriting from a certain C++ base class (including all Blueprint-generated classes) or
b) find a class by its name (again, including Blueprint-generatec classes)
I’ve tried a lot of things but couldn’t get anything to work in a standalone game (some things worked in the editor, but not in the game). Then today I came across this:
My problem is that I just have no idea how FClassFinder works and it’s impossible to find any kind of useful information about it on the internet. I’ve tried a few things myself, but so far I only got assertion fails. Can anyone give a usage example on this function? As in: what is the template parameter I have to pass in (I assume this is my C++ base-class?) and what kind of string do I have to pass in? And does this support both C++ and Blueprint-classes?
I’m on Unreal Engine 4.1.1, by the way. Don’t know if this is important, but it seems that the function’s implementation has changed since then.
Thanks, that actually seems quite helpful! By now I’ve solved my problem in another (less elegant) way, using FObjectFinder to load the UBlueprint I needed, but this should come in handy if I switch to another UE version in the future.
Another question, though: Is there a way to get a blueprint’s path at runtime? Assuming I had:
which would return “BotPawn” in this case. But is there away to actually get the full path to my blueprint (“/Game/Blueprints/Pawns/BotPawn” in this case) from either BotPawnClass or BotPawnBlueprint?
And another question: What would I do, if I also wanted to find C++ classes with FClassFinder? How would I do that? Do I just pass in the class name? I can’t possibly pass in a “path” to my C++ path, or can I?