unreal.UnrealEditorSubsystem

class unreal.UnrealEditorSubsystem(outer: Object | None = None, name: Name | str = 'None')

Bases: EditorSubsystem

UUnrealEditorSubsystem Subsystem for exposing editor functionality to scripts

C++ Source:

  • Module: UnrealEd

  • File: UnrealEditorSubsystem.h

get_editor_world() World

Find the World in the world editor. It can then be used as WorldContext by other libraries like GameplayStatics.

Returns:

The World used by the world editor.

Return type:

World

get_game_world() World

Get Game World

Return type:

World

get_level_viewport_camera_info() (camera_location=Vector, camera_rotation=Rotator) or None

Gets information about the camera position for the primary level editor viewport. In non-editor builds, these will be zeroed In the UnrealEd module instead of Level Editor as it uses FLevelEditorViewportClient which is in this module

Returns:

Whether or not we were able to get a camera for a level editing viewport

camera_location (Vector): (out) Current location of the level editing viewport camera, or zero if none found

camera_rotation (Rotator): (out) Current rotation of the level editing viewport camera, or zero if none found

Return type:

tuple or None

get_level_viewport_size() IntPoint or None

Returns the size of the primary level editor viewport.

Returns:

True if there is a primary level editor viewport.

size (IntPoint): (out) The dimensions of the viewport (in pixels).

Return type:

IntPoint or None

screen_to_world(screen_position) (world_position=Vector, world_direction=Vector) or None

Transforms the given 2D screen space coordinate into a 3D world-space point and direction using the primary level editor viewport.

Parameters:

screen_position (Vector2D) – 2D screen space to deproject. (in pixels)

Returns:

True if the position was able to be projected. False otherwise.

world_position (Vector): (out) Corresponding 3D position in world space.

world_direction (Vector): (out) World space direction vector away from the camera at the given 2d point.

Return type:

tuple or None

set_level_viewport_camera_info(camera_location, camera_rotation) None

Sets information about the camera position for the primary level editor viewport. In the UnrealEd module instead of Level Editor as it uses FLevelEditorViewportClient which is in this module

Parameters:
  • camera_location (Vector) – Location the camera will be moved to.

  • camera_rotation (Rotator) – Rotation the camera will be set to.

world_to_screen(world_position) Vector2D or None

Transforms the given 3D world-space point into a its 2D screen space coordinate using the primary level editor viewport.

Parameters:

world_position (Vector) – World position to project.

Returns:

True if the position was able to be projected. False otherwise.

screen_position (Vector2D): (out) Corresponding 2D position in screen space (in pixels)

Return type:

Vector2D or None