Get / Set Editor Properties
Getting and Setting the Properties on an asset
For Blueprint Assets in the Content Browser, not everything is directly available on the results of unreal.load_asset()
. With the asset loaded from the Content Browser we can really only set its parent class properties that are listed on the UE Python Docs:
asset_path = "/Game/EUW_my_tool"
asset = unreal.load_asset(asset_path)
asset.set_editor_property("blueprint_description", "My EUW Tool")

For properties added in the Blueprint Editor we will either need the Class Default Object or an instance of it:
asset_instance = unreal.new_object(asset.generated_class())
# or
default_object = unreal.get_default_object(asset.generated_class())
With an appropriate asset instance we can use the following code to read the desired property:
asset_name = asset_instance.get_editor_property("name")
When setting property values we have two options
asset_instance.set_editor_property("name", "Eugene")
asset_instance.set_editor_properties({
"name": "Eugene",
"type": "duck"
})
Note: Read-Only properties do exist in Unreal, if a property doesn't appear to set correctly in Python it could be Read-Only

Last updated