Can't capture property path 'Static Mesh / Material[0]', with Python, when scripting variant manager

I’m scripting the Variant Manager with python to auto build a LevelVariantSets asset with some actors and materials. I can’t figure out a way to capture the ‘Static Mesh Component / Material[0]’ property path. I always get the following error:

LogVariantManager: Error: Actor ‘Sphere’ does not have a property with path ‘Static Mesh Component / Material[0]’!

If I set up a LevelVariantSets object in the Variant Manager manually, I can set this property path, just not through python scripting. Also, tried to capture a bunch of other property paths with python and they all work. This seems like a python bug.

some sample code:

var_mngr = unreal.VariantManagerLibrary()

var_sets = var_mngr.create_level_variant_sets_asset(‘variant_test_new’, ‘/Game’)

var_set = unreal.VariantSet()

var_set.set_display_text(‘color’)

variant = unreal.Variant()

variant.set_display_text(‘blue’)

var_mngr.add_variant_set(var_sets, var_set)

var_mngr.add_variant(var_set, variant)

world_util = unreal.EditorLevelLibrary()

actor_sel = world_util.get_selected_level_actors()

for actor in actor_sel:

var_mngr.add_actor_binding(var_mngr, actor)
var_mngr.capture_property(var_mngr, actor, 'Static Mesh Component / Material[0]')	

Thanks for any any insight you can provide! This is a weird one…

1 Like