vse2020
(vse2020)
1
Why? Documentation makes no indication of what the argument should be, probably because there shouldn’t be one for a get_current_level query.
unreal.LevelEditorSubsystem.get_current_level() returns error:
TypeError: descriptor ‘get_current_level’ of ‘LevelEditorSubsystem’ object needs an argument
from Documentation:
https://docs.unrealengine.com/5.0/en-US/PythonAPI/class/LevelEditorSubsystem.html?highlight=subsystem#unreal.LevelEditorSubsystem
get_current_level()
Get the current level used by the world editor.
Returns: The current level
Return type: Level
I’m assuming there’s a subsystem provider somewhere.
This still works in the meantime
world = unreal.EditorLevelLibrary.get_editor_world()
levels = unreal.EditorLevelUtils.get_levels(world)
level = levels[0] if len(levels) else None
ilozen
(ilozen)
3
Had the same problem. Here’s what worked for me:
import unreal
from unreal import LevelEditorSubsystem
les = unreal.get_editor_subsystem(LevelEditorSubsystem)
les.get_current_level()
TON14
(TON14)
4
unreal.EditorLevelLibrary.get_editor_world().get_name()