Skip to content

GameFramework

16 tools. Back to the index.

create_game_instance_class_bp

Additive, idempotent.

Create a Blueprint subclass of UGameInstance, registered and marked dirty but not saved (persist it with save_asset). Idempotent on re-run: a Blueprint already at that path whose parent derives from parent_class is returned with already_exists=true; one with another parent is an error and is left untouched. parent_class is read off the Blueprint.

Parameter Type Required Description
asset_name string yes Name for the new Blueprint asset.
parent_class string yes Parent class name; must derive from UGameInstance.
package_path string no Target content folder; defaults to /Game/MCP.

Returns: { asset_name, asset_path, package_class, parent_class, already_exists }

create_game_mode_class_bp

Additive, idempotent.

Create an AGameModeBase-derivative Blueprint asset at package_path/asset_name, registered and marked dirty but not saved (persist it with save_asset). Idempotent on re-run: a Blueprint already at that path whose parent derives from parent_class is returned with already_exists=true; one with another parent is an error and is left untouched. parent_class and is_multiplayer are read off the Blueprint.

Parameter Type Required Description
asset_name string yes Name for the new Blueprint asset
parent_class string yes Parent class name (must derive from AGameModeBase; AGameMode also accepted for multiplayer)
package_path string no Target content folder; defaults to /Game/MCP

Returns: { asset_name: string, asset_path: string, package_path: string, package_class: string, parent_class: string, is_multiplayer: bool, already_exists: bool }

create_game_state_class_bp

Additive, idempotent.

Create a Blueprint subclass of AGameStateBase (or AGameState) at package_path/asset_name with FKismetEditorUtilities::CreateBlueprint, registered and marked dirty but NOT saved -- persist it with save_asset. Idempotent on re-run: a Blueprint already at that path whose parent derives from parent_class is returned as is with already_exists=true; one with another parent is an error and is left untouched. parent_class is read off the Blueprint. A parent_class that does not resolve or derive from AGameStateBase, or a name taken by another asset class, is an error. Refused during PIE unless force. Siblings: create_game_mode_class_bp, create_player_state_class_bp.

Parameter Type Required Description
asset_name string yes Name for the new Blueprint asset.
parent_class string yes Parent class name; must derive from AGameStateBase.
package_path string no Target content folder; defaults to /Game/MCP.

Returns: { asset_name, asset_path, package_class, parent_class, already_exists }

create_hud_class_bp

Additive, idempotent.

Create a Blueprint subclass of AHUD, registered and marked dirty but not saved (persist it with save_asset). Idempotent on re-run: a Blueprint already at that path whose parent derives from parent_class is returned with already_exists=true; one with another parent is an error and is left untouched. parent_class is read off the Blueprint.

Parameter Type Required Description
asset_name string yes Name for the new Blueprint asset.
parent_class string yes Parent class name; must derive from AHUD.
package_path string no Target content folder; defaults to /Game/MCP.

Returns: { asset_name, asset_path, package_class, parent_class, already_exists }

create_player_controller_class_bp

Additive, idempotent.

Create a Blueprint subclass of APlayerController, registered and marked dirty but not saved (persist it with save_asset). Idempotent on re-run: a Blueprint already at that path whose parent derives from parent_class is returned with already_exists=true; one with another parent is an error and is left untouched. parent_class is read off the Blueprint.

Parameter Type Required Description
asset_name string yes Name for the new Blueprint asset.
parent_class string yes Parent class name; must derive from APlayerController.
package_path string no Target content folder; defaults to /Game/MCP.

Returns: { asset_name, asset_path, package_class, parent_class, already_exists }

create_player_state_class_bp

Additive, idempotent.

Create a Blueprint subclass of APlayerState, registered and marked dirty but not saved (persist it with save_asset). Idempotent on re-run: a Blueprint already at that path whose parent derives from parent_class is returned with already_exists=true; one with another parent is an error and is left untouched. parent_class is read off the Blueprint.

Parameter Type Required Description
asset_name string yes Name for the new Blueprint asset.
parent_class string yes Parent class name; must derive from APlayerState.
package_path string no Target content folder; defaults to /Game/MCP.

Returns: { asset_name, asset_path, package_class, parent_class, already_exists }

get_game_mode_info

Read-only.

Read the AGameModeBase CDO's class slots (DefaultPawnClass, HUDClass, PlayerStateClass, GameStateClass, SpectatorClass, PlayerControllerClass) and the world settings' DefaultGameMode override.

Parameter Type Required Description
game_mode_class string no Optional AGameModeBase class name (short or /Script/ path)
game_mode_class_path string no Optional long /Script/Engine.GameModeBase path (takes precedence)

Returns: { game_mode_class: string, parent_class: string, is_multiplayer: bool, default_pawn_class: string, hud_class: string, player_state_class: string, game_state_class: string, spectator_class: string, player_controller_class: string, world_settings_default_game_mode?: string }

place_player_start

Additive.

Spawn an APlayerStart actor in the editor world at the given location with optional rotation + player-start tag. Location AND rotation are RE-READ from the actor after writing them, so a mismatch is visible instead of echoed back.

Parameter Type Required Description
location array no [X, Y, Z] world location for the spawn point.
rotation array no Optional world rotation. TWO forms: the unambiguous OBJECT form {"roll":R,"pitch":P,"yaw":Y} (RECOMMENDED) or the ambiguous ARRAY form [Pitch, Yaw, Roll] -- note the array order, index 2 is ROLL, not yaw. Default identity.
player_start_tag string no Optional FName for the PlayerStart.Tag UPROPERTY (e.g. "Red", "Spectator", "DM"). Used by AGameModeBase to filter start points by team.
name string no Optional label for the new actor. Defaults to "PlayerStart_N".

Returns: { actor_name, location: [x,y,z] (RE-READ from the actor), rotation: {roll,pitch,yaw} (RE-READ from the actor, axes NAMED), is_spatially_loaded: bool, location_matches_request: bool, rotation_matches_request: bool, player_start_tag, spawned: bool, already_existed: bool, requested: { location, rotation, player_start_tag, name } }

register_spawn_point

Additive.

Mark an existing actor as a registered spawn point for the project (sets PlayerStartTag + ensures it's a APlayerStart). Useful for tagging generic actors as respawn anchors in lieu of placing APlayerStarts.

Parameter Type Required Description
actor_name string yes Name or label of the actor to mark as a spawn point.
player_start_tag string no Optional FName tag (e.g. "Red"/"Blue" for team filtering; "Respawn" for general spawn anchors).

Returns: { actor_name, was_player_start, promoted_to_player_start: bool, player_start_tag }

reset_game_mode_override

Destructive, idempotent.

Inverse of set_game_mode_override: clears the per-world GameMode override (AWorldSettings::DefaultGameMode) back to null, so the world falls back to the engine's URL/INI DefaultGameMode. Takes no parameters and acts on the current editor world.

No parameters.

Returns: { reset, world_name, previous_default_game_mode }

set_game_mode_default_pawn

Destructive, idempotent.

Write DefaultPawnClass on the class default object (CDO) of an AGameModeBase subclass, picked by game_mode_class_path or else game_mode_class (one is required), to pawn_class, which must derive from APawn; a class that does not resolve or derive is an error. GameModes spawned later (the next PIE) use it. A Blueprint GameMode's CDO is modified and its package marked dirty but not saved: persist it with save_asset (persistable true). A native GameMode class has no savable package, so its value lasts only until the editor closes (persistable false). default_pawn_class is read back from the CDO. Read the slots with get_game_mode_info; set_game_mode_override picks the GameMode of the level.

Parameter Type Required Description
pawn_class string yes APawn-derivative class name
game_mode_class string no Optional AGameModeBase class name (short or /Script/ path)
game_mode_class_path string no Optional long /Script/Engine.GameModeBase path (takes precedence)

Returns: { game_mode_class: string, default_pawn_class: string, persistable: bool }

set_game_mode_game_state_class

Destructive, idempotent.

Set the AGameModeBase::GameStateClass UPROPERTY on the GameMode's CDO. A Blueprint GameMode's package is marked dirty but not saved (persist it with save_asset); a native class's value lasts only until the editor closes (persistable false). game_state_class is read back from the CDO.

Parameter Type Required Description
game_state_class string yes AGameStateBase-derivative class name (NoClear: empty/None rejected)
game_mode_class string no Optional AGameModeBase class name (short or /Script/ path)
game_mode_class_path string no Optional long /Script/Engine.GameModeBase path (takes precedence)

Returns: { game_mode_class: string, game_state_class: string, already_set: bool, persistable: bool }

set_game_mode_hud_class

Destructive, idempotent.

Set the AGameModeBase::HUDClass UPROPERTY on the GameMode's CDO. A Blueprint GameMode's package is marked dirty but not saved (persist it with save_asset); a native class's value lasts only until the editor closes (persistable false). hud_class is read back from the CDO.

Parameter Type Required Description
hud_class string yes AHUD-derivative class name
game_mode_class string no Optional AGameModeBase class name (short or /Script/ path)
game_mode_class_path string no Optional long /Script/Engine.GameModeBase path (takes precedence)

Returns: { game_mode_class: string, hud_class: string, persistable: bool }

set_game_mode_override

Destructive, idempotent.

Set the AWorldSettings::DefaultGameMode override on the current editor world.

Parameter Type Required Description
game_mode_class string yes AGameModeBase-derivative class name (short or /Script/ path)

Returns: { world_settings_path: string, default_game_mode: string, is_multiplayer: bool }

set_game_mode_player_state_class

Destructive, idempotent.

Set the AGameModeBase::PlayerStateClass UPROPERTY on the GameMode's CDO. A Blueprint GameMode's package is marked dirty but not saved (persist it with save_asset); a native class's value lasts only until the editor closes (persistable false). player_state_class is read back from the CDO.

Parameter Type Required Description
player_state_class string yes APlayerState-derivative class name
game_mode_class string no Optional AGameModeBase class name (short or /Script/ path)
game_mode_class_path string no Optional long /Script/Engine.GameModeBase path (takes precedence)

Returns: { game_mode_class: string, player_state_class: string, persistable: bool }

set_game_mode_spectator_class

Destructive, idempotent.

Set the AGameModeBase::SpectatorClass UPROPERTY on the GameMode's CDO. A Blueprint GameMode's package is marked dirty but not saved (persist it with save_asset); a native class's value lasts only until the editor closes (persistable false). spectator_class is read back from the CDO.

Parameter Type Required Description
spectator_class string yes ASpectatorPawn-derivative class name (NoClear: empty/None rejected)
game_mode_class string no Optional AGameModeBase class name (short or /Script/ path)
game_mode_class_path string no Optional long /Script/Engine.GameModeBase path (takes precedence)

Returns: { game_mode_class: string, spectator_class: string, already_set: bool, persistable: bool }