unreal.GameViewportSubsystem

class unreal.GameViewportSubsystem(outer: Optional[Object] = None, name: Union[Name, str] = 'None')

Bases: GameInstanceSubsystem

Game Viewport Subsystem

C++ Source:

  • Module: UMG

  • File: GameViewportSubsystem.h

add_widget(widget, slot) None

Adds it to the game’s viewport.

Parameters:
add_widget_for_player(widget, player, slot) None

Adds the widget to the game’s viewport in the section dedicated to the player. This is valuable in a split screen game where you need to only show a widget over a player’s portion of the viewport.

Parameters:
get_widget_slot(widget) GameViewportWidgetSlot

The slot info from previously added widget or info that is store for later.

Parameters:

widget (Widget) –

Return type:

GameViewportWidgetSlot

is_widget_added(widget) bool
Parameters:

widget (Widget) –

Returns:

true if the widget was added to the viewport using AddWidget or AddWidgetForPlayer.

Return type:

bool

remove_widget(widget) None

Removes the widget from the viewport.

Parameters:

widget (Widget) –

set_widget_slot(widget, slot) None

Update the slot info of a previously added widget or Store the slot info for later use.

Parameters:
classmethod set_widget_slot_desired_size(slot, size) GameViewportWidgetSlot

Helper function to set the desired size in the viewport for the Slot.

Parameters:
Return type:

GameViewportWidgetSlot

classmethod set_widget_slot_position(slot, widget, position, remove_dpi_scale) GameViewportWidgetSlot

Helper function to set the position in the viewport for the Slot.

Parameters:
  • slot (GameViewportWidgetSlot) –

  • widget (Widget) –

  • position (Vector2D) – The 2D position to set the widget to in the viewport.

  • remove_dpi_scale (bool) – If you’ve already calculated inverse DPI, set this to false. Otherwise inverse DPI is applied to the position so that when the location is scaled by DPI, it ends up in the expected position.

Return type:

GameViewportWidgetSlot