add existing sub-level by python in UE4.25

anonymous_user_67718b91
Mon, 17 May 2021 10:34:48 +0000
Editor Scripting

I’m trying to load a sublevel into the current level in python, but I don’t know how.

I found this article and tried it, but I get the following error message.

Epic Developer Community Forums – 24 Aug 20

Could add a sub-level to current level with python?

Here is a function called : create_new_streaming_level in unreal.EditorLevelUtils — Unreal Python 4.27 (Experimental) documentation But could create a sub-level by existing level?

world = unreal.EditorLevelLibrary.get_editor_world()
levelStreaming = unreal.EditorLevelUtils().add_level_to_world_transform(world, subLevelPath , unreal.LevelStreamingAlwaysLoaded)

error:
LogPython: Error: ‘EditorLevelUtils’ object has no attribute ‘add_level_to_world’

It seems that this function is new in 4.26.
Is there any way to load it in 4.25?

Reference:
https://docs.unrealengine.com/en-US/PythonAPI/class/EditorLevelUtils.html

1 post - 1 participant