Is there a way to get actual blueprint class from the Asset Registry?
When listing classes from the asset registry the 'Get Class' function returns 'Blueprint' or other basic asset types. I would like to get a class which can then be used to cast for a desired custom blueprint subclass. Is this possible in blueprint scripting?
asked Sep 09 '17 at 07:18 AM in Blueprint Scripting
Turns out it is quite easy to get the parent class of a blueprint asset. The asset registry will always return UBlueprint objects, but those objects themselves have a property ParentClass, which is the class that you're probably interested in. This class corresponds with the Native Parent Class that you can see when hovering over an asset in the editor.
For my purpose, I wanted to distinguish between inherited classes and the actual class itself too, which you can do using the IsChildOf method once you have the class you desire. In the snippet, Asset is of type FAssetData, and ClassType is a pointer to a UClass.
answered Oct 16 '18 at 01:49 PM
I assume you want to cast to blueprint in C++, no you can not do that as it's technically impossible as class needs to exist in C++ to be valid C++ type. Everything gets compiled down to pure numbers, classes are practically just logical feature that only exists in compilation process and desolves in to machine code, so you can not use the class from blueprint.
You can only get UClass pointer from UBlueprint class via GeneratedClass variable and then use it to spawn actor for example, but you can only cast it to the most highest class that is in C++ and it's related to blueprint. I think (and thats just a guess) you could make node in blueprint in C++ by doing some hackish stuff in reflection system or (and this one for sure) by making new UK2Node.
answered Oct 16 '18 at 10:30 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here