Python - Get parent class

Hi,

How do I get the parent class from a list of blueprints?

i.e Blueprint Actor Class, Character, Pawn Class. etc?

I can’t find the method that will return ‘Actor’, ‘Character’ , ‘Pawn’ as the class.

I tried asset_class in AssetRegistryHelpers but that yields the same result of Blueprint.

Appreciate any help!


# select blueprints in content folder
# run script


import unreal


for sel in unreal.EditorUtilityLibrary().get_selected_assets():
print sel.get_class()
print sel.get_class().get_name()

LogPython: <Object ‘/Script/Engine.Blueprint’ (0x000001E63136B600) Class ‘Class’>
LogPython: Blueprint
LogPython: <Object ‘/Script/Engine.Blueprint’ (0x000001E63136B600) Class ‘Class’>
LogPython: Blueprint
LogPython: <Object ‘/Script/Engine.Blueprint’ (0x000001E63136B600) Class ‘Class’>
LogPython: Blueprint


for sel in unreal.EditorUtilityLibrary().get_selected_assets():
print sel.get_class()
print sel.get_class().get_name()

path_gen = str(sel.get_path_name()) + '_C'
bp_gc = unreal.load_object(None, path_gen)
bcd = unreal.get_default_object(bp_gc)

print bcd.get_class()
print bcd.get_class().get_name() 

Hey thanks for the reply but I’m still getting the same return value of just Class and Blueprint. Not Actor, Character or Pawn Class.

I’m testing this on 25.1.

This should work. Tested in 4.25.3


for sel in unreal.EditorUtilityLibrary().get_selected_assets():
    bp = unreal.EditorAssetLibrary.load_blueprint_class(sel.get_path_name())
    print(unreal.get_type_from_class(bp))


2 Likes