Beginner question about assets manipulation in editor (python)

Hi everyone, I’m new to python in Unreal… I’m trying to generate simple box collisions for selected assets in the content browser, I’m able to make the selection but when I try to remove the current collision I get an error of bad type, this is the code

#Get the selected assets
selection = unreal.EditorUtilityLibrary.get_selected_assets()

#Remove current collisions
for sel in selection:
unreal.StaticMeshEditorSubsystem.remove_collisions(sel)

But then I get this error:
TypeError: descriptor ‘remove_collisions’ requires a ‘StaticMeshEditorSubsystem’ object but received a ‘StaticMesh’

Try this instead, you need to get an instance of the StaticMeshEditorSubsystem:

smes = unreal.get_editor_subsystem(unreal.StaticMeshEditorSubsystem)
smes.remove_collisions(sel)

1 Like

It worked perfectly… Thank you very much!!