waddellt15
(waddellt15)
February 3, 2020, 6:50pm
3
anonymous_user_cfc18edb:
Hi, I wasn’t sure if by level you meant export every single object in your game, or just the actual “World” object.
I think this might help though:
def export_level(level_name="MyLevel"):
asset_registry = unreal.AssetRegistryHelpers.get_asset_registry()
levels = asset_registry.get_assets_by_class("World")
level_to_export = None
for level in levels:
if level.get_editor_property("asset_name") == level_name:
level_to_export = level.get_asset()
if not level_to_export:
return
export_task = unreal.AssetExportTask()
export_task.set_editor_property("object", level_to_export)
export_task.set_editor_property("filename", "C:\ est\\{}_exportData".format(level_name))
export_task.set_editor_property("automated", True)
export_task.set_editor_property("exporter", unreal.LevelExporterLOD())
unreal.Exporter.run_asset_export_task(export_task)
This was incredibly helpful! The small error I am having with it is that it is prompting for FBX settings when I run the function, is there anyway to circumvent this?
1 Like