unreal.GameplayStatics

class unreal.GameplayStatics(outer=None, name='None')

Bases: unreal.BlueprintFunctionLibrary

Static class with useful gameplay utility functions that can be called from both Blueprint and C++

C++ Source:

  • Module: Engine

  • File: GameplayStatics.h

classmethod activate_reverb_effect(world_context_object, reverb_effect, tag_name, priority=0.000000, volume=0.500000, fade_time=2.000000) None

Activates a Reverb Effect without the need for an Audio Volume

Parameters
  • world_context_object (Object) –

  • reverb_effect (ReverbEffect) – Reverb Effect to use

  • tag_name (Name) – Tag to associate with Reverb Effect

  • priority (float) – Priority of the Reverb Effect

  • volume (float) – Volume level of Reverb Effect

  • fade_time (float) – Time before Reverb Effect is fully active

classmethod announce_accessible_string(announcement_string) None

If accessibility is enabled, have the platform announce a string to the player. These announcements can be interrupted by system accessibiliity announcements or other accessibility announcement requests. This should be used judiciously as flooding a player with announcements can be overrwhelming and confusing. Try to make announcements concise and clear. NOTE: Currently only supported on Win10, Mac, iOS

Parameters

announcement_string (str) –

classmethod apply_damage(damaged_actor, base_damage, event_instigator, damage_causer, damage_type_class) float

Hurts the specified actor with generic damage.

Parameters
  • damaged_actor (Actor) – Actor that will be damaged.

  • base_damage (float) – The base damage to apply.

  • event_instigator (Controller) – Controller that was responsible for causing this damage (e.g. player who shot the weapon)

  • damage_causer (Actor) – Actor that actually caused the damage (e.g. the grenade that exploded)

  • damage_type_class (type(Class)) – Class that describes the damage that was done.

Returns

Actual damage the ended up being applied to the actor.

Return type

float

classmethod apply_point_damage(damaged_actor, base_damage, hit_from_direction, hit_info, event_instigator, damage_causer, damage_type_class) float

Hurts the specified actor with the specified impact.

Parameters
  • damaged_actor (Actor) – Actor that will be damaged.

  • base_damage (float) – The base damage to apply.

  • hit_from_direction (Vector) – Direction the hit came FROM

  • hit_info (HitResult) – Collision or trace result that describes the hit

  • event_instigator (Controller) – Controller that was responsible for causing this damage (e.g. player who shot the weapon)

  • damage_causer (Actor) – Actor that actually caused the damage (e.g. the grenade that exploded)

  • damage_type_class (type(Class)) – Class that describes the damage that was done.

Returns

Actual damage the ended up being applied to the actor.

Return type

float

classmethod apply_radial_damage(world_context_object, base_damage, origin, damage_radius, damage_type_class, ignore_actors, damage_causer=None, instigated_by_controller=None, do_full_damage=False, damage_prevention_channel=CollisionChannel.ECC_VISIBILITY) bool

Hurt locally authoritative actors within the radius. Will only hit components that block the Visibility channel.

Parameters
  • world_context_object (Object) –

  • base_damage (float) – The base damage to apply, i.e. the damage at the origin.

  • origin (Vector) – Epicenter of the damage area.

  • damage_radius (float) – Radius of the damage area, from Origin

  • damage_type_class (type(Class)) – Class that describes the damage that was done.

  • ignore_actors (Array(Actor)) – List of Actors to ignore

  • damage_causer (Actor) – Actor that actually caused the damage (e.g. the grenade that exploded). This actor will not be damaged and it will not block damage.

  • instigated_by_controller (Controller) – Controller that was responsible for causing this damage (e.g. player who threw the grenade)

  • do_full_damage (bool) –

  • damage_prevention_channel (CollisionChannel) – Damage will not be applied to victim if there is something between the origin and the victim which blocks traces on this channel

Returns

true if damage was applied to at least one actor.

Return type

bool

classmethod apply_radial_damage_with_falloff(world_context_object, base_damage, minimum_damage, origin, damage_inner_radius, damage_outer_radius, damage_falloff, damage_type_class, ignore_actors, damage_causer=None, instigated_by_controller=None, damage_prevention_channel=CollisionChannel.ECC_VISIBILITY) bool

Hurt locally authoritative actors within the radius. Will only hit components that block the Visibility channel.

Parameters
  • world_context_object (Object) –

  • base_damage (float) – The base damage to apply, i.e. the damage at the origin.

  • minimum_damage (float) –

  • origin (Vector) – Epicenter of the damage area.

  • damage_inner_radius (float) – Radius of the full damage area, from Origin

  • damage_outer_radius (float) – Radius of the minimum damage area, from Origin

  • damage_falloff (float) – Falloff exponent of damage from DamageInnerRadius to DamageOuterRadius

  • damage_type_class (type(Class)) – Class that describes the damage that was done.

  • ignore_actors (Array(Actor)) – List of Actors to ignore

  • damage_causer (Actor) – Actor that actually caused the damage (e.g. the grenade that exploded)

  • instigated_by_controller (Controller) – Controller that was responsible for causing this damage (e.g. player who threw the grenade)

  • damage_prevention_channel (CollisionChannel) – Damage will not be applied to victim if there is something between the origin and the victim which blocks traces on this channel

Returns

true if damage was applied to at least one actor.

Return type

bool

classmethod are_any_listeners_within_range(world_context_object, location, maximum_range) bool

Determines if any audio listeners are within range of the specified location note: This will always return false if there is no audio device, or the audio device is disabled.

Parameters
  • world_context_object (Object) –

  • location (Vector) – The location from which test if a listener is in range

  • maximum_range (float) – The distance away from Location to test if any listener is within

Return type

bool

classmethod are_subtitles_enabled() bool

Returns whether or not subtitles are currently enabled.

Returns

true if subtitles are enabled.

Return type

bool

classmethod blueprint_predict_projectile_path_advanced(world_context_object, predict_params) PredictProjectilePathResult or None

Predict the arc of a virtual projectile affected by gravity with collision checks along the arc. Returns true if it hit something.

Parameters
Returns

True if hit something along the path (if tracing with collision).

predict_result (PredictProjectilePathResult): Output result of the trace (Hit result, array of location/velocity/times for each trace step, etc).

Return type

PredictProjectilePathResult or None

classmethod blueprint_predict_projectile_path_by_object_type(world_context_object, start_pos, launch_velocity, trace_path, projectile_radius, object_types, trace_complex, actors_to_ignore, draw_debug_type, draw_debug_time, sim_frequency=15.000000, max_sim_time=2.000000, override_gravity_z=0.000000) (out_hit=HitResult, out_path_positions=Array(Vector), out_last_trace_destination=Vector) or None

Predict the arc of a virtual projectile affected by gravity with collision checks along the arc. Returns a list of positions of the simulated arc and the destination reached by the simulation. Returns true if it hit something.

Parameters
  • world_context_object (Object) –

  • start_pos (Vector) – First start trace location

  • launch_velocity (Vector) – Velocity the “virtual projectile” is launched at

  • trace_path (bool) – Trace along the entire path to look for blocking hits

  • projectile_radius (float) – Radius of the virtual projectile to sweep against the environment

  • object_types (Array(ObjectTypeQuery)) – ObjectTypes to trace against, if bTracePath is true.

  • trace_complex (bool) – Use TraceComplex (trace against triangles not primitives)

  • actors_to_ignore (Array(Actor)) – Actors to exclude from the traces

  • draw_debug_type (DrawDebugTrace) – Debug type (one-frame, duration, persistent)

  • draw_debug_time (float) – Duration of debug lines (only relevant for DrawDebugType::Duration)

  • sim_frequency (float) – Determines size of each sub-step in the simulation (chopping up MaxSimTime)

  • max_sim_time (float) – Maximum simulation time for the virtual projectile.

  • override_gravity_z (float) – Optional override of Gravity (if 0, uses WorldGravityZ)

Returns

True if hit something along the path if tracing for collision.

out_hit (HitResult): Predicted hit result, if the projectile will hit something

out_path_positions (Array(Vector)): Predicted projectile path. Ordered series of positions from StartPos to the end. Includes location at point of impact if it hit something.

out_last_trace_destination (Vector): Goal position of the final trace it did. Will not be in the path if there is a hit.

Return type

tuple or None

classmethod blueprint_predict_projectile_path_by_trace_channel(world_context_object, start_pos, launch_velocity, trace_path, projectile_radius, trace_channel, trace_complex, actors_to_ignore, draw_debug_type, draw_debug_time, sim_frequency=15.000000, max_sim_time=2.000000, override_gravity_z=0.000000) (out_hit=HitResult, out_path_positions=Array(Vector), out_last_trace_destination=Vector) or None

Predict the arc of a virtual projectile affected by gravity with collision checks along the arc. Returns a list of positions of the simulated arc and the destination reached by the simulation. Returns true if it hit something (if tracing with collision).

Parameters
  • world_context_object (Object) –

  • start_pos (Vector) – First start trace location

  • launch_velocity (Vector) – Velocity the “virtual projectile” is launched at

  • trace_path (bool) – Trace along the entire path to look for blocking hits

  • projectile_radius (float) – Radius of the virtual projectile to sweep against the environment

  • trace_channel (CollisionChannel) – TraceChannel to trace against, if bTracePath is true.

  • trace_complex (bool) – Use TraceComplex (trace against triangles not primitives)

  • actors_to_ignore (Array(Actor)) – Actors to exclude from the traces

  • draw_debug_type (DrawDebugTrace) – Debug type (one-frame, duration, persistent)

  • draw_debug_time (float) – Duration of debug lines (only relevant for DrawDebugType::Duration)

  • sim_frequency (float) – Determines size of each sub-step in the simulation (chopping up MaxSimTime)

  • max_sim_time (float) – Maximum simulation time for the virtual projectile.

  • override_gravity_z (float) – Optional override of Gravity (if 0, uses WorldGravityZ)

Returns

True if hit something along the path (if tracing with collision).

out_hit (HitResult): Predicted hit result, if the projectile will hit something

out_path_positions (Array(Vector)): Predicted projectile path. Ordered series of positions from StartPos to the end. Includes location at point of impact if it hit something.

out_last_trace_destination (Vector): Goal position of the final trace it did. Will not be in the path if there is a hit.

Return type

tuple or None

classmethod blueprint_suggest_projectile_velocity(world_context_object, start_location, end_location, launch_speed, override_gravity_z, trace_option, collision_radius, favor_high_arc, draw_debug) Vector or None

Calculates an launch velocity for a projectile to hit a specified point.

Parameters
  • world_context_object (Object) –

  • start_location (Vector) – Intended launch location

  • end_location (Vector) – Desired landing location

  • launch_speed (float) – Desired launch speed

  • override_gravity_z (float) – Optional gravity override. 0 means “do not override”.

  • trace_option (SuggestProjVelocityTraceOption) – Controls whether or not to validate a clear path by tracing along the calculated arc

  • collision_radius (float) – Radius of the projectile (assumed spherical), used when tracing

  • favor_high_arc (bool) – If true and there are 2 valid solutions, will return the higher arc. If false, will favor the lower arc.

  • draw_debug (bool) – When true, a debug arc is drawn (red for an invalid arc, green for a valid arc)

Returns

Returns false if there is no valid solution or the valid solutions are blocked. Returns true otherwise.

toss_velocity (Vector): (output) Result launch velocity.

Return type

Vector or None

classmethod cancel_async_loading() None

Cancels all currently queued streaming packages

classmethod clear_sound_mix_class_override(world_context_object, sound_mix_modifier, sound_class, fade_out_time=1.000000) None

Clears any existing override of the Sound Class Adjuster in the given Sound Mix

Parameters
  • world_context_object (Object) –

  • sound_mix_modifier (SoundMix) – The sound mix to modify.

  • sound_class (SoundClass) – The sound class in the sound mix to clear overrides from.

  • fade_out_time (float) – The interpolation time to use to go from the current sound class adjuster override values to the non-override values.

classmethod clear_sound_mix_modifiers(world_context_object) None

Clear all sound mix modifiers from the audio system

Parameters

world_context_object (Object) –

classmethod clear_sound_mode(world_context_object)

deprecated: ‘clear_sound_mode’ was renamed to ‘clear_sound_mix_modifiers’.

classmethod create_player(world_context_object, controller_id=- 1, spawn_player_controller=True) PlayerController

Create a new local player for this game, for cases like local multiplayer.

Parameters
  • world_context_object (Object) –

  • controller_id (int32) – The ID of the physical controller that the should control the newly created player. A value of -1 specifies to use the next available ID

  • spawn_player_controller (bool) – Whether a player controller should be spawned immediately for this player. If false a player controller will not be created automatically until transition to the next map.

Returns

The created player controller if one is created.

Return type

PlayerController

classmethod create_save_game_object(save_game_class) SaveGame

Create a new, empty SaveGame object to set data on and then pass to SaveGameToSlot.

Parameters

save_game_class (type(Class)) – Class of SaveGame to create

Returns

New SaveGame object to write data to

Return type

SaveGame

classmethod create_sound2d(world_context_object, sound, volume_multiplier=1.000000, pitch_multiplier=1.000000, start_time=0.000000, concurrency_settings=None, persist_across_level_transition=False, auto_destroy=True) AudioComponent

This function allows users to create Audio Components in advance of playback with settings specifically for non-spatialized, non-distance-attenuated sounds. Audio Components created using this function by default will not have Spatialization applied.

Parameters
  • world_context_object (Object) –

  • sound (SoundBase) – Sound to create.

  • volume_multiplier (float) – A linear scalar multiplied with the volume, in order to make the sound louder or softer.

  • pitch_multiplier (float) – A linear scalar multiplied with the pitch.

  • start_time (float) – How far into the sound to begin playback at

  • concurrency_settings (SoundConcurrency) – Override concurrency settings package to play sound with

  • persist_across_level_transition (bool) –

  • auto_destroy (bool) – Whether the returned audio component will be automatically cleaned up when the sound finishes (by completing or stopping), or whether it can be reactivated

Returns

An audio component to manipulate the created sound

Return type

AudioComponent

classmethod deactivate_reverb_effect(world_context_object, tag_name) None

Deactivates a Reverb Effect that was applied outside of an Audio Volume

Parameters
  • world_context_object (Object) –

  • tag_name (Name) – Tag associated with Reverb Effect to remove

classmethod delete_game_in_slot(slot_name, user_index) bool

Delete a save game in a particular slot.

Parameters
  • slot_name (str) – Name of save game slot to delete.

  • user_index (int32) – For some platforms, master user index to identify the user doing the deletion.

Returns

True if a file was actually able to be deleted. use DoesSaveGameExist to distinguish between delete failures and failure due to file not existing.

Return type

bool

classmethod deproject_screen_to_world(player, 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.

Parameters
  • player (PlayerController) – Deproject using this player’s view.

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

Returns

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

classmethod does_save_game_exist(slot_name, user_index) bool

See if a save game exists with the specified name.

Parameters
  • slot_name (str) – Name of save game slot.

  • user_index (int32) – For some platforms, master user index to identify the user doing the saving.

Return type

bool

classmethod enable_live_streaming(enable) None

Toggle live DVR streaming.

Parameters

enable (bool) – If true enable streaming, otherwise disable.

classmethod find_collision_uv(hit, uv_channel) Vector2D or None

Try and find the UV for a collision impact. Note this ONLY works if ‘Support UV From Hit Results’ is enabled in Physics Settings.

Parameters
Returns

uv (Vector2D):

Return type

Vector2D or None

classmethod find_nearest_actor(origin, actors_to_check) -> (Actor, distance=float)

Returns an Actor nearest to Origin from ActorsToCheck array.

Parameters
  • origin (Vector) – World Location from which the distance is measured.

  • actors_to_check (Array(Actor)) – Array of Actors to examine and return Actor nearest to Origin.

Returns

Nearest Actor.

distance (float): Distance from Origin to the returned Actor.

Return type

float

classmethod flush_level_streaming(world_context_object) None

Flushes level streaming in blocking fashion and returns when all sub-levels are loaded / visible / hidden

Parameters

world_context_object (Object) –

classmethod get_accurate_real_time() -> (seconds=int32, partial_seconds=float)

Returns time in seconds since the application was started. Unlike the other time functions this is accurate to the exact time this function is called instead of set once per frame.

Returns

seconds (int32):

partial_seconds (float):

Return type

tuple

classmethod get_actor_array_average_location(actors) Vector

Find the average location (centroid) of an array of Actors

Parameters

actors (Array(Actor)) –

Return type

Vector

classmethod get_actor_array_bounds(actors, only_colliding_components) -> (center=Vector, box_extent=Vector)

Bind the bounds of an array of Actors

Parameters
Returns

center (Vector):

box_extent (Vector):

Return type

tuple

classmethod get_actor_of_class(world_context_object, actor_class) Actor

Find the first Actor in the world of the specified class. This is a slow operation, use with caution e.g. do not use every frame.

Parameters
  • world_context_object (Object) –

  • actor_class (type(Class)) – Class of Actor to find. Must be specified or result will be empty.

Returns

Actor of the specified class.

Return type

Actor

classmethod get_all_actors_of_class(world_context_object, actor_class)

Find all Actors in the world of the specified class. This is a slow operation, use with caution e.g. do not use every frame.

Parameters
  • world_context_object (Object) –

  • actor_class (type(Class)) – Class of Actor to find. Must be specified or result array will be empty.

Returns

out_actors (Array(Actor)): Output array of Actors of the specified class.

Return type

Array(Actor)

classmethod get_all_actors_of_class_with_tag(world_context_object, actor_class, tag)

Find all Actors in the world of the specified class with the specified tag. This is a slow operation, use with caution e.g. do not use every frame.

Parameters
  • world_context_object (Object) –

  • actor_class (type(Class)) – Class of Actor to find. Must be specified or result array will be empty.

  • tag (Name) – Tag to find. Must be specified or result array will be empty.

Returns

out_actors (Array(Actor)): Output array of Actors of the specified tag.

Return type

Array(Actor)

classmethod get_all_actors_with_interface(world_context_object, interface)

Find all Actors in the world with the specified interface. This is a slow operation, use with caution e.g. do not use every frame.

Parameters
  • world_context_object (Object) –

  • interface (type(Class)) – Interface to find. Must be specified or result array will be empty.

Returns

out_actors (Array(Actor)): Output array of Actors of the specified interface.

Return type

Array(Actor)

classmethod get_all_actors_with_tag(world_context_object, tag)

Find all Actors in the world with the specified tag. This is a slow operation, use with caution e.g. do not use every frame.

Parameters
  • world_context_object (Object) –

  • tag (Name) – Tag to find. Must be specified or result array will be empty.

Returns

out_actors (Array(Actor)): Output array of Actors of the specified tag.

Return type

Array(Actor)

classmethod get_audio_time_seconds(world_context_object) float

Returns time in seconds since world was brought up for play, IS stopped when game pauses, NOT dilated/clamped.

Parameters

world_context_object (Object) –

Return type

float

classmethod get_closest_listener_location(world_context_object, location, maximum_range, allow_attenuation_override) Vector or None

Finds and returns the position of the closest listener to the specified location note: This will always return false if there is no audio device, or the audio device is disabled.

Parameters
  • world_context_object (Object) –

  • location (Vector) – The location from which we’d like to find the closest listener, in world space.

  • maximum_range (float) – The maximum distance away from Location that a listener can be.

  • allow_attenuation_override (bool) – True for the adjusted listener position (if attenuation override is set), false for the raw listener position (for panning)

Returns

true if we’ve successfully found a listener within MaximumRange of Location, otherwise false.

listener_position (Vector): [Out] The position of the closest listener in world space, if found.

Return type

Vector or None

classmethod get_current_level_name(world_context_object, remove_prefix_string=True) str

Get the name of the currently-open level.

Parameters
  • world_context_object (Object) –

  • remove_prefix_string (bool) – remove any streaming- or editor- added prefixes from the level name.

Return type

str

classmethod get_current_reverb_effect(world_context_object) ReverbEffect

Returns the highest priority reverb settings currently active from any source (Audio Volumes or manual settings).

Parameters

world_context_object (Object) –

Return type

ReverbEffect

classmethod get_enable_world_rendering(world_context_object) bool

Returns the world rendering state

Parameters

world_context_object (Object) –

Returns

Whether the world should be rendered or not

Return type

bool

classmethod get_game_info(world_context_object)

deprecated: ‘get_game_info’ was renamed to ‘get_game_mode’.

classmethod get_game_instance(world_context_object) GameInstance

Returns the game instance object

Parameters

world_context_object (Object) –

Return type

GameInstance

classmethod get_game_mode(world_context_object) GameModeBase

Returns the current GameModeBase or Null if it can’t be retrieved, such as on the client

Parameters

world_context_object (Object) –

Return type

GameModeBase

classmethod get_game_replication_info(world_context_object)

deprecated: ‘get_game_replication_info’ was renamed to ‘get_game_state’.

classmethod get_game_state(world_context_object) GameStateBase

Returns the current GameStateBase or Null if it can’t be retrieved

Parameters

world_context_object (Object) –

Return type

GameStateBase

classmethod get_global_time_dilation(world_context_object) float

Gets the current global time dilation.

Parameters

world_context_object (Object) –

Returns

Current time dilation.

Return type

float

classmethod get_int_option(options, key, default_value) int32

Find an option in the options string and return it as an integer.

Parameters
  • options (str) – The string containing the options.

  • key (str) – The key to find the value of in Options.

  • default_value (int32) –

Returns

The value associated with Key as an integer if Key found in Options string, otherwise DefaultValue.

Return type

int32

classmethod get_key_value(pair) -> (key=str, value=str)

Break up a key=value pair into its key and value.

Parameters

pair (str) – The string containing a pair to split apart.

Returns

key (str): (out) Key portion of Pair. If no = in string will be the same as Pair.

value (str): (out) Value portion of Pair. If no = in string will be empty.

Return type

tuple

classmethod get_max_audio_channel_count(world_context_object) int32

Retrieves the max voice count currently used by the audio engine.

Parameters

world_context_object (Object) –

Return type

int32

classmethod get_num_local_player_controllers(world_context_object) int32

Returns the number of fully initialized local players, this will be 0 on dedicated servers. Indexes up to this can be used as PlayerIndex parameters for the following functions, and you are guaranteed to get a local player controller.

Parameters

world_context_object (Object) –

Return type

int32

classmethod get_num_player_controllers(world_context_object) int32

Returns the total number of available player controllers, including remote players when called on a server. Indexes up to this can be used as PlayerIndex parameters for the following functions.

Parameters

world_context_object (Object) –

Return type

int32

classmethod get_num_player_states(world_context_object) int32

Returns the number of active player states, there is one player state for every connected player even if they are a remote client. Indexes up to this can be use as PlayerStateIndex parameters for other functions.

Parameters

world_context_object (Object) –

Return type

int32

classmethod get_object_class(object)

Returns the class of a passed in Object, will always be valid if Object is not NULL

Parameters

object (Object) –

Return type

type(Class)

classmethod get_platform_name() str

Returns the string name of the current platform, to perform different behavior based on platform. (Platform names include Windows, Mac, IOS, Android, PS4, XboxOne, Linux)

Return type

str

classmethod get_player_camera(world_context_object, player_index)

deprecated: ‘get_player_camera’ was renamed to ‘get_player_camera_manager’.

classmethod get_player_camera_manager(world_context_object, player_index) PlayerCameraManager

Returns the camera manager for the Player Controller at the specified player index. This will not include remote clients with no player controller.

Parameters
  • world_context_object (Object) –

  • player_index (int32) – Index in the player controller list, starting first with local players and then available remote ones

Return type

PlayerCameraManager

classmethod get_player_character(world_context_object, player_index) Character

Returns the pawn for the player controller at the specified player index, will return null if the pawn is not a character. This will not include characters of remote clients with no available player controller, you can iterate the PlayerStates list for that.

Parameters
  • world_context_object (Object) –

  • player_index (int32) – Index in the player controller list, starting first with local players and then available remote ones

Return type

Character

classmethod get_player_controller(world_context_object, player_index) PlayerController

Returns the player controller found while iterating through the local and available remote player controllers. On a network client, this will only include local players as remote player controllers are not available. The index will be consistent as long as no new players join or leave, but it will not be the same across different clients and servers.

Parameters
  • world_context_object (Object) –

  • player_index (int32) – Index in the player controller list, starting first with local players and then available remote ones

Return type

PlayerController

classmethod get_player_controller_from_id(world_context_object, controller_id) PlayerController

Returns the player controller with the specified physical controller ID. This only works for local players.

Parameters
  • world_context_object (Object) –

  • controller_id (int32) – Physical controller ID, the same value returned from Get Player Controller ID

Return type

PlayerController

classmethod get_player_controller_id(player) int32

Gets what physical controller ID a player is using. This only works for local player controllers.

Parameters

player (PlayerController) – The player controller of the player to get the ID of

Returns

The ID of the passed in player. -1 if there is no physical controller assigned to the passed in player

Return type

int32

classmethod get_player_pawn(world_context_object, player_index) Pawn

Returns the pawn for the player controller at the specified player index. This will not include pawns of remote clients with no available player controller, you can use the player states list for that.

Parameters
  • world_context_object (Object) –

  • player_index (int32) – Index in the player controller list, starting first with local players and then available remote ones

Return type

Pawn

classmethod get_player_state(world_context_object, player_state_index) PlayerState

Returns the player state at the given index in the game state’s PlayerArray. This will work on both the client and server and the index will be consistent. After initial replication, all clients and the server will have access to PlayerStates for all connected players.

Parameters
  • world_context_object (Object) –

  • player_state_index (int32) – Index into the game state’s PlayerArray

Return type

PlayerState

classmethod get_player_state_from_unique_net_id(world_context_object, unique_id) PlayerState

Returns the player state that matches the passed in online id, or null for an invalid one. This will work on both the client and server for local and remote players.

Parameters
Return type

PlayerState

classmethod get_real_time_seconds(world_context_object) float

Returns time in seconds since world was brought up for play, does NOT stop when game pauses, NOT dilated/clamped

Parameters

world_context_object (Object) –

Return type

float

classmethod get_streaming_level(world_context_object, package_name) LevelStreaming

Returns level streaming object with specified level package name

Parameters
  • world_context_object (Object) –

  • package_name (Name) –

Return type

LevelStreaming

classmethod get_surface_type(hit) PhysicalSurface

Returns the EPhysicalSurface type of the given Hit. To edit surface type for your project, use ProjectSettings/Physics/PhysicalSurface section

Parameters

hit (HitResult) –

Return type

PhysicalSurface

classmethod get_time_seconds(world_context_object) float

Returns time in seconds since world was brought up for play, adjusted by time dilation and IS stopped when game pauses

Parameters

world_context_object (Object) –

Return type

float

classmethod get_unpaused_time_seconds(world_context_object) float

Returns time in seconds since world was brought up for play, adjusted by time dilation and IS NOT stopped when game pauses

Parameters

world_context_object (Object) –

Return type

float

classmethod get_view_projection_matrix(desired_view) -> (view_matrix=Matrix, projection_matrix=Matrix, view_projection_matrix=Matrix)

Returns the View Matrix, Projection Matrix and the View x Projection Matrix for a given view

Parameters

desired_view (MinimalViewInfo) – FMinimalViewInfo struct for a camera.

Returns

view_matrix (Matrix): (out) Corresponding View Matrix

projection_matrix (Matrix): (out) Corresponding Projection Matrix

view_projection_matrix (Matrix): (out) Corresponding View x Projection Matrix

Return type

tuple

classmethod get_viewport_mouse_capture_mode(world_context_object) MouseCaptureMode

Returns the current viewport mouse capture mode

Parameters

world_context_object (Object) –

Return type

MouseCaptureMode

classmethod get_world_delta_seconds(world_context_object) float

Returns the frame delta time in seconds, adjusted by time dilation.

Parameters

world_context_object (Object) –

Return type

float

classmethod get_world_origin_location(world_context_object) IntVector

Returns world origin current location.

Parameters

world_context_object (Object) –

Return type

IntVector

classmethod grass_overlapping_sphere_count(world_context_object, static_mesh, center_position, radius) int32

Counts how many grass foliage instances overlap a given sphere.

Parameters
  • world_context_object (Object) –

  • static_mesh (StaticMesh) –

  • center_position (Vector) – The center position of the sphere.

  • radius (float) – The radius of the sphere.

Returns

Number of foliage instances with their mesh set to Mesh that overlap the sphere.

Return type

int32

classmethod has_launch_option(option_to_check) bool

Checks the commandline to see if the desired option was specified on the commandline (e.g. -demobuild)

Parameters

option_to_check (str) –

Returns

True if the launch option was specified on the commandline, false otherwise

Return type

bool

classmethod has_option(options, key) bool

Returns whether a key exists in an options string.

Parameters
  • options (str) – The string containing the options.

  • key (str) –

Returns

Whether Key was found in Options.

Return type

bool

classmethod is_game_paused(world_context_object) bool

Returns the game’s paused state

Parameters

world_context_object (Object) –

Returns

Whether the game is currently paused or not

Return type

bool

classmethod is_splitscreen_force_disabled(world_context_object) bool

Returns the split screen state

Parameters

world_context_object (Object) –

Returns

Whether the game viewport is split screen or not

Return type

bool

classmethod k2_set_sound_mode(world_context_object, sound_mix)

deprecated: ‘k2_set_sound_mode’ was renamed to ‘set_base_sound_mix’.

classmethod load_game_from_slot(slot_name, user_index) SaveGame

Load the contents from a given slot.

Parameters
  • slot_name (str) – Name of the save game slot to load from.

  • user_index (int32) – For some platforms, master user index to identify the user doing the loading.

Returns

Object containing loaded game state (nullptr if load fails)

Return type

SaveGame

classmethod load_stream_level(world_context_object, level_name, make_visible_after_load, should_block_on_load, latent_info) None

Stream the level (by Name); Calling again before it finishes has no effect

Parameters
classmethod load_stream_level_by_soft_object_ptr(world_context_object, level, make_visible_after_load, should_block_on_load, latent_info) None

Stream the level (by Object Reference); Calling again before it finishes has no effect

Parameters
classmethod open_level(world_context_object, level_name, absolute=True, options='') None

Travel to another level

Parameters
  • world_context_object (Object) –

  • level_name (Name) – the level to open

  • absolute (bool) – if true options are reset, if false options are carried over from current level

  • options (str) – a string of options to use for the travel URL

classmethod open_level_by_soft_object_ptr(world_context_object, level, absolute=True, options='') None

Travel to another level

Parameters
  • world_context_object (Object) –

  • level (World) – the level to open

  • absolute (bool) – if true options are reset, if false options are carried over from current level

  • options (str) – a string of options to use for the travel URL

classmethod parse_option(options, key) str

Find an option in the options string and return it.

Parameters
  • options (str) – The string containing the options.

  • key (str) – The key to find the value of in Options.

Returns

The value associated with Key if Key found in Options string.

Return type

str

classmethod play_dialogue2d(world_context_object, dialogue, context, volume_multiplier=1.000000, pitch_multiplier=1.000000, start_time=0.000000) None

Plays a dialogue directly with no attenuation, perfect for UI.

  • Fire and Forget.

  • Not Replicated.

Parameters
  • world_context_object (Object) –

  • dialogue (DialogueWave) – dialogue to play

  • context (DialogueContext) – context the dialogue is to play in

  • volume_multiplier (float) – A linear scalar multiplied with the volume, in order to make the sound louder or softer.

  • pitch_multiplier (float) – A linear scalar multiplied with the pitch.

  • start_time (float) – How far in to the dialogue to begin playback at

classmethod play_dialogue_at_location(world_context_object, dialogue, context, location, rotation, volume_multiplier=1.000000, pitch_multiplier=1.000000, start_time=0.000000, attenuation_settings=None) None
Plays a dialogue at the given location. This is a fire and forget sound and does not travel with any actor.

Replication is also not handled at this point.

Parameters
  • world_context_object (Object) –

  • dialogue (DialogueWave) – dialogue to play

  • context (DialogueContext) – context the dialogue is to play in

  • location (Vector) – World position to play dialogue at

  • rotation (Rotator) – World rotation to play dialogue at

  • volume_multiplier (float) – A linear scalar multiplied with the volume, in order to make the sound louder or softer.

  • pitch_multiplier (float) – A linear scalar multiplied with the pitch.

  • start_time (float) – How far in to the dialogue to begin playback at

  • attenuation_settings (SoundAttenuation) – Override attenuation settings package to play sound with

classmethod play_dialogue_attached(dialogue, context, attach_to_component, attach_point_name='None', location=[0.0, 0.0, 0.0], rotation=[0.0, 0.0, 0.0], location_type=AttachLocation.KEEP_RELATIVE_OFFSET, stop_when_attached_to_destroyed=False, volume_multiplier=1.0, pitch_multiplier=1.0, start_time=0.0, attenuation_settings=None, auto_destroy=True)

deprecated: ‘play_dialogue_attached’ was renamed to ‘spawn_dialogue_attached’.

classmethod play_sound2d(world_context_object, sound, volume_multiplier=1.000000, pitch_multiplier=1.000000, start_time=0.000000, concurrency_settings=None, owning_actor=None, is_ui_sound=True) None

Plays a sound directly with no attenuation, perfect for UI sounds.

  • Fire and Forget.

  • Not Replicated.

Parameters
  • world_context_object (Object) –

  • sound (SoundBase) – Sound to play.

  • volume_multiplier (float) – A linear scalar multiplied with the volume, in order to make the sound louder or softer.

  • pitch_multiplier (float) – A linear scalar multiplied with the pitch.

  • start_time (float) – How far in to the sound to begin playback at

  • concurrency_settings (SoundConcurrency) – Override concurrency settings package to play sound with

  • owning_actor (Actor) – The actor to use as the “owner” for concurrency settings purposes. Allows PlaySound calls to do a concurrency limit per owner.

  • is_ui_sound (bool) – True if sound is UI related, else false

classmethod play_sound_at_location(world_context_object, sound, location, rotation, volume_multiplier=1.000000, pitch_multiplier=1.000000, start_time=0.000000, attenuation_settings=None, concurrency_settings=None, owning_actor=None, initial_params=None) None

Plays a sound at the given location. This is a fire and forget sound and does not travel with any actor. Replication is also not handled at this point.

Parameters
  • world_context_object (Object) –

  • sound (SoundBase) – sound to play

  • location (Vector) – World position to play sound at

  • rotation (Rotator) – World rotation to play sound at

  • volume_multiplier (float) – A linear scalar multiplied with the volume, in order to make the sound louder or softer.

  • pitch_multiplier (float) – A linear scalar multiplied with the pitch.

  • start_time (float) – How far in to the sound to begin playback at

  • attenuation_settings (SoundAttenuation) – Override attenuation settings package to play sound with

  • concurrency_settings (SoundConcurrency) – Override concurrency settings package to play sound with

  • owning_actor (Actor) – The actor to use as the “owner” for concurrency settings purposes. Allows PlaySound calls to do a concurrency limit per owner.

  • initial_params (InitialActiveSoundParams) –

classmethod play_sound_attached(sound, attach_to_component, attach_point_name='None', location=[0.0, 0.0, 0.0], rotation=[0.0, 0.0, 0.0], location_type=AttachLocation.KEEP_RELATIVE_OFFSET, stop_when_attached_to_destroyed=False, volume_multiplier=1.0, pitch_multiplier=1.0, start_time=0.0, attenuation_settings=None, concurrency_settings=None, auto_destroy=True)

deprecated: ‘play_sound_attached’ was renamed to ‘spawn_sound_attached’.

classmethod play_world_camera_shake(world_context_object, shake, epicenter, inner_radius, outer_radius, falloff=1.000000, orient_shake_towards_epicenter=False) None

Plays an in-world camera shake that affects all nearby local players, with distance-based attenuation. Does not replicate.

Parameters
  • world_context_object (Object) – Object that we can obtain a world context from

  • shake (type(Class)) – Camera shake asset to use

  • epicenter (Vector) – location to place the effect in world space

  • inner_radius (float) – Cameras inside this radius are ignored

  • outer_radius (float) – Cameras outside of InnerRadius and inside this are effected

  • falloff (float) – Affects falloff of effect as it nears OuterRadius

  • orient_shake_towards_epicenter (bool) – Changes the rotation of shake to point towards epicenter instead of forward

classmethod pop_sound_mix_modifier(world_context_object, sound_mix_modifier) None

Pop a sound mix modifier from the audio system

Parameters
  • world_context_object (Object) –

  • sound_mix_modifier (SoundMix) – The Sound Mix Modifier to remove from the system

classmethod pop_sound_mode(world_context_object, sound_mix_modifier)

deprecated: ‘pop_sound_mode’ was renamed to ‘pop_sound_mix_modifier’.

classmethod predict_projectile_path(world_context_object, start_pos, launch_velocity, trace_path, projectile_radius, object_types, trace_complex, actors_to_ignore, draw_debug_type, draw_debug_time, sim_frequency=15.0, max_sim_time=2.0, override_gravity_z=0.0)

deprecated: ‘predict_projectile_path’ was renamed to ‘blueprint_predict_projectile_path_by_object_type’.

classmethod prime_all_sounds_in_sound_class(sound_class) None

Primes the sound waves in the given USoundClass, caching the first chunk of streamed audio.

Parameters

sound_class (SoundClass) –

classmethod prime_sound(sound) None

Primes the sound, caching the first chunk of streamed audio.

Parameters

sound (SoundBase) –

classmethod project_world_to_screen(player, world_position, player_viewport_relative=False) Vector2D or None

Transforms the given 3D world-space point into a its 2D screen space coordinate.

Parameters
  • player (PlayerController) – Project using this player’s view.

  • world_position (Vector) – World position to project.

  • player_viewport_relative (bool) – Should this be relative to the player viewport subregion (useful when using player attached widgets in split screen)

Returns

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

Return type

Vector2D or None

classmethod push_sound_mix_modifier(world_context_object, sound_mix_modifier) None

Push a sound mix modifier onto the audio system

Parameters
  • world_context_object (Object) –

  • sound_mix_modifier (SoundMix) – The Sound Mix Modifier to add to the system

classmethod push_sound_mode(world_context_object, sound_mix_modifier)

deprecated: ‘push_sound_mode’ was renamed to ‘push_sound_mix_modifier’.

classmethod rebase_local_origin_onto_zero(world_context_object, world_location) Vector

Returns origin based position for local world location.

Parameters
  • world_context_object (Object) –

  • world_location (Vector) –

Return type

Vector

classmethod rebase_zero_origin_onto_local(world_context_object, world_location) Vector

Returns local location for origin based position.

Parameters
  • world_context_object (Object) –

  • world_location (Vector) –

Return type

Vector

classmethod remove_player(player, destroy_pawn) None

Removes a local player from this game.

Parameters
  • player (PlayerController) – The player controller of the player to be removed

  • destroy_pawn (bool) – Whether the controlled pawn should be deleted as well

classmethod save_game_to_slot(save_game_object, slot_name, user_index) bool

Save the contents of the SaveGameObject to a platform-specific save slot/file. note: This will write out all non-transient properties, the SaveGame property flag is not checked

Parameters
  • save_game_object (SaveGame) – Object that contains data about the save game that we want to write out

  • slot_name (str) – Name of save game slot to save to.

  • user_index (int32) – For some platforms, master user index to identify the user doing the saving.

Returns

Whether we successfully saved this information

Return type

bool

classmethod set_base_sound_mix(world_context_object, sound_mix) None

Set the sound mix of the audio system for special EQing

Parameters
classmethod set_enable_world_rendering(world_context_object, enable) None

Enabled rendering of the world

Parameters
  • world_context_object (Object) –

  • enable (bool) – Whether the world should be rendered or not

classmethod set_force_disable_splitscreen(world_context_object, disable) None

Enables split screen

Parameters
  • world_context_object (Object) –

  • disable (bool) – Whether the viewport should split screen between local players or not

classmethod set_game_paused(world_context_object, paused) bool

Sets the game’s paused state

Parameters
  • world_context_object (Object) –

  • paused (bool) – Whether the game should be paused or not

Returns

Whether the game was successfully paused/unpaused

Return type

bool

classmethod set_global_listener_focus_parameters(world_context_object, focus_azimuth_scale=1.000000, non_focus_azimuth_scale=1.000000, focus_distance_scale=1.000000, non_focus_distance_scale=1.000000, focus_volume_scale=1.000000, non_focus_volume_scale=1.000000, focus_priority_scale=1.000000, non_focus_priority_scale=1.000000) None

Sets the global listener focus parameters, which will scale focus behavior of sounds based on their focus azimuth settings in their attenuation settings.

  • Fire and Forget.

  • Not Replicated.

Parameters
  • world_context_object (Object) –

  • focus_azimuth_scale (float) – An angle scale value used to scale the azimuth angle that defines where sounds are in-focus.

  • non_focus_azimuth_scale (float) –

  • focus_distance_scale (float) – A distance scale value to use for sounds which are in-focus. Values < 1.0 will reduce perceived distance to sounds, values > 1.0 will increase perceived distance to in-focus sounds.

  • non_focus_distance_scale (float) – A distance scale value to use for sounds which are out-of-focus. Values < 1.0 will reduce perceived distance to sounds, values > 1.0 will increase perceived distance to in-focus sounds.

  • focus_volume_scale (float) –

  • non_focus_volume_scale (float) –

  • focus_priority_scale (float) – A priority scale value (> 0.0) to use for sounds which are in-focus. Values < 1.0 will reduce the priority of in-focus sounds, values > 1.0 will increase the priority of in-focus sounds.

  • non_focus_priority_scale (float) – A priority scale value (> 0.0) to use for sounds which are out-of-focus. Values < 1.0 will reduce the priority of sounds out-of-focus sounds, values > 1.0 will increase the priority of out-of-focus sounds.

classmethod set_global_pitch_modulation(world_context_object, pitch_modulation, time_sec) None

Sets a global pitch modulation scalar that will apply to all non-UI sounds

  • Fire and Forget.

  • Not Replicated.

Parameters
  • world_context_object (Object) –

  • pitch_modulation (float) – A pitch modulation value to globally set.

  • time_sec (float) – A time value to linearly interpolate the global modulation pitch over from it’s current value.

classmethod set_global_time_dilation(world_context_object, time_dilation) None

Sets the global time dilation.

Parameters
  • world_context_object (Object) –

  • time_dilation (float) – value to set the global time dilation to

classmethod set_max_audio_channels_scaled(world_context_object, max_channel_count_scale) None

Sets the max number of voices (also known as “channels”) dynamically by percentage. E.g. if you want to temporarily reduce voice count by 50%, use 0.50. Later, you can return to the original max voice count by using 1.0.

Parameters
  • world_context_object (Object) –

  • max_channel_count_scale (float) – The percentage of the original voice count to set the max number of voices to

classmethod set_player_controller_id(player, controller_id) None

Sets what physical controller ID a player should be using. This only works for local player controllers.

Parameters
  • player (PlayerController) – The player controller of the player to change the controller ID of

  • controller_id (int32) – The controller ID to assign to this player

classmethod set_sound_class_distance_scale(world_context_object, sound_class, distance_attenuation_scale, time_sec=0.000000) None

Linearly interpolates the attenuation distance scale value from it’s current attenuation distance override value (1.0f it not overridden) to its new attenuation distance override, over the given amount of time

  • Fire and Forget.

  • Not Replicated.

Parameters
  • world_context_object (Object) –

  • sound_class (SoundClass) – Sound class to to use to set the attenuation distance scale on.

  • distance_attenuation_scale (float) – A scalar for the attenuation distance used for computing distance attenuation.

  • time_sec (float) – A time value to linearly interpolate from the current distance attenuation scale value to the new value.

classmethod set_sound_mix_class_override(world_context_object, sound_mix_modifier, sound_class, volume=1.000000, pitch=1.000000, fade_in_time=1.000000, apply_to_children=True) None
Overrides the sound class adjuster in the given sound mix. If the sound class does not exist in the input sound mix,

the sound class adjuster will be added to the list of active sound mix modifiers.

Parameters
  • world_context_object (Object) –

  • sound_mix_modifier (SoundMix) – The sound mix to modify.

  • sound_class (SoundClass) – The sound class to override (or add) in the sound mix.

  • volume (float) – The volume scale to set the sound class adjuster to.

  • pitch (float) – The pitch scale to set the sound class adjuster to.

  • fade_in_time (float) – The interpolation time to use to go from the current sound class adjuster values to the new values.

  • apply_to_children (bool) – Whether or not to apply this override to the sound class’ children or to just the specified sound class.

classmethod set_subtitles_enabled(enabled) None

Will set subtitles to be enabled or disabled.

Parameters

enabled (bool) – will enable subtitle drawing if true, disable if false.

classmethod set_time_dilation(world_context_object, time_dilation)

deprecated: ‘set_time_dilation’ was renamed to ‘set_global_time_dilation’.

classmethod set_viewport_mouse_capture_mode(world_context_object, mouse_capture_mode) None

Sets the current viewport mouse capture mode

Parameters
classmethod set_world_origin_location(world_context_object, new_location) None

Requests a new location for a world origin.

Parameters
classmethod spawn_decal_at_location(world_context_object, decal_material, decal_size, location, rotation=[0.000000, - 90.000000, 0.000000], life_span=0.000000) DecalComponent

Spawns a decal at the given location and rotation, fire and forget. Does not replicate.

Parameters
  • world_context_object (Object) –

  • decal_material (MaterialInterface) – decal’s material

  • decal_size (Vector) – size of decal

  • location (Vector) – location to place the decal in world space

  • rotation (Rotator) – rotation to place the decal in world space

  • life_span (float) – destroy decal component after time runs out (0 = infinite)

Return type

DecalComponent

classmethod spawn_decal_attached(decal_material, decal_size, attach_to_component, attach_point_name='None', location=[0.000000, 0.000000, 0.000000], rotation=[0.000000, 0.000000, 0.000000], location_type=AttachLocation.KEEP_RELATIVE_OFFSET, life_span=0.000000) DecalComponent

Spawns a decal attached to and following the specified component. Does not replicate.

Parameters
  • decal_material (MaterialInterface) – decal’s material

  • decal_size (Vector) – size of decal

  • attach_to_component (SceneComponent) –

  • attach_point_name (Name) – Optional named point within the AttachComponent to spawn the emitter at

  • location (Vector) – Depending on the value of Location Type this is either a relative offset from the attach component/point or an absolute world position that will be translated to a relative offset

  • rotation (Rotator) – Depending on the value of LocationType this is either a relative offset from the attach component/point or an absolute world rotation that will be translated to a realative offset

  • location_type (AttachLocation) – Specifies whether Location is a relative offset or an absolute world position

  • life_span (float) – destroy decal component after time runs out (0 = infinite)

Return type

DecalComponent

classmethod spawn_dialogue2d(world_context_object, dialogue, context, volume_multiplier=1.000000, pitch_multiplier=1.000000, start_time=0.000000, auto_destroy=True) AudioComponent

Spawns a DialogueWave, a special type of Asset that requires Context data in order to resolve a specific SoundBase, which is then passed on to the new Audio Component. Audio Components created using this function by default will not have Spatialization applied. Sound instances will begin playing upon spawning this Audio Component.

  • Not Replicated.

Parameters
  • world_context_object (Object) –

  • dialogue (DialogueWave) – dialogue to play

  • context (DialogueContext) – context the dialogue is to play in

  • volume_multiplier (float) – A linear scalar multiplied with the volume, in order to make the sound louder or softer.

  • pitch_multiplier (float) – A linear scalar multiplied with the pitch.

  • start_time (float) – How far in to the dialogue to begin playback at

  • auto_destroy (bool) – Whether the returned audio component will be automatically cleaned up when the sound finishes (by completing or stopping) or whether it can be reactivated

Returns

An audio component to manipulate the spawned sound

Return type

AudioComponent

classmethod spawn_dialogue_at_location(world_context_object, dialogue, context, location, rotation=[0.000000, 0.000000, 0.000000], volume_multiplier=1.000000, pitch_multiplier=1.000000, start_time=0.000000, attenuation_settings=None, auto_destroy=True) AudioComponent

Spawns a DialogueWave, a special type of Asset that requires Context data in order to resolve a specific SoundBase, which is then passed on to the new Audio Component. This function allows users to create and play Audio Components at a specific World Location and Rotation. Useful for spatialized and/or distance-attenuated dialogue.

Parameters
  • world_context_object (Object) –

  • dialogue (DialogueWave) – Dialogue to play

  • context (DialogueContext) – Context the dialogue is to play in

  • location (Vector) – World position to play dialogue at

  • rotation (Rotator) – World rotation to play dialogue at

  • volume_multiplier (float) – A linear scalar multiplied with the volume, in order to make the sound louder or softer.

  • pitch_multiplier (float) – A linear scalar multiplied with the pitch.

  • start_time (float) – How far into the dialogue to begin playback at

  • attenuation_settings (SoundAttenuation) – Override attenuation settings package to play sound with

  • auto_destroy (bool) – Whether the returned audio component will be automatically cleaned up when the sound finishes (by completing or stopping) or whether it can be reactivated

Returns

Audio Component to manipulate the playing dialogue with

Return type

AudioComponent

classmethod spawn_dialogue_attached(dialogue, context, attach_to_component, attach_point_name='None', location=[0.000000, 0.000000, 0.000000], rotation=[0.000000, 0.000000, 0.000000], location_type=AttachLocation.KEEP_RELATIVE_OFFSET, stop_when_attached_to_destroyed=False, volume_multiplier=1.000000, pitch_multiplier=1.000000, start_time=0.000000, attenuation_settings=None, auto_destroy=True) AudioComponent
Spawns a DialogueWave, a special type of Asset that requires Context data in order to resolve a specific SoundBase,

which is then passed on to the new Audio Component. This function allows users to create and play Audio Components attached to a specific Scene Component. Useful for spatialized and/or distance-attenuated dialogue that needs to follow another object in space.

Parameters
  • dialogue (DialogueWave) – dialogue to play

  • context (DialogueContext) – context the dialogue is to play in

  • attach_to_component (SceneComponent) –

  • attach_point_name (Name) – Optional named point within the AttachComponent to play the sound at

  • location (Vector) – Depending on the value of Location Type this is either a relative offset from the attach component/point or an absolute world position that will be translated to a relative offset

  • rotation (Rotator) – Depending on the value of Location Type this is either a relative offset from the attach component/point or an absolute world rotation that will be translated to a relative offset

  • location_type (AttachLocation) – Specifies whether Location is a relative offset or an absolute world position

  • stop_when_attached_to_destroyed (bool) – Specifies whether the sound should stop playing when the owner its attached to is destroyed.

  • volume_multiplier (float) – A linear scalar multiplied with the volume, in order to make the sound louder or softer.

  • pitch_multiplier (float) – A linear scalar multiplied with the pitch.

  • start_time (float) – How far in to the dialogue to begin playback at

  • attenuation_settings (SoundAttenuation) – Override attenuation settings package to play sound with

  • auto_destroy (bool) – Whether the returned audio component will be automatically cleaned up when the sound finishes (by completing or stopping) or whether it can be reactivated

Returns

Audio Component to manipulate the playing dialogue with

Return type

AudioComponent

classmethod spawn_emitter_at_location(world_context_object, emitter_template, location, rotation=[0.000000, 0.000000, 0.000000], scale=[1.000000, 1.000000, 1.000000], auto_destroy=True, pooling_method=PSCPoolMethod.NONE, auto_activate_system=True) ParticleSystemComponent

Plays the specified effect at the given location and rotation, fire and forget. The system will go away when the effect is complete. Does not replicate.

Parameters
  • world_context_object (Object) – Object that we can obtain a world context from

  • emitter_template (ParticleSystem) – particle system to create

  • location (Vector) – location to place the effect in world space

  • rotation (Rotator) – rotation to place the effect in world space

  • scale (Vector) – scale to create the effect at

  • auto_destroy (bool) – Whether the component will automatically be destroyed when the particle system completes playing or whether it can be reactivated

  • pooling_method (PSCPoolMethod) – Method used for pooling this component. Defaults to none.

  • auto_activate_system (bool) –

Return type

ParticleSystemComponent

classmethod spawn_emitter_attached(emitter_template, attach_to_component, attach_point_name='None', location=[0.000000, 0.000000, 0.000000], rotation=[0.000000, 0.000000, 0.000000], scale=[1.000000, 1.000000, 1.000000], location_type=AttachLocation.KEEP_RELATIVE_OFFSET, auto_destroy=True, pooling_method=PSCPoolMethod.NONE, auto_activate=True) ParticleSystemComponent

Plays the specified effect attached to and following the specified component. The system will go away when the effect is complete. Does not replicate.

Parameters
  • emitter_template (ParticleSystem) – particle system to create

  • attach_to_component (SceneComponent) –

  • attach_point_name (Name) – Optional named point within the AttachComponent to spawn the emitter at

  • location (Vector) – Depending on the value of LocationType this is either a relative offset from the attach component/point or an absolute world location that will be translated to a relative offset (if LocationType is KeepWorldPosition).

  • rotation (Rotator) – Depending on the value of LocationType this is either a relative offset from the attach component/point or an absolute world rotation that will be translated to a relative offset (if LocationType is KeepWorldPosition).

  • scale (Vector) – Depending on the value of LocationType this is either a relative scale from the attach component or an absolute world scale that will be translated to a relative scale (if LocationType is KeepWorldPosition).

  • location_type (AttachLocation) – Specifies whether Location is a relative offset or an absolute world position

  • auto_destroy (bool) – Whether the component will automatically be destroyed when the particle system completes playing or whether it can be reactivated

  • pooling_method (PSCPoolMethod) – Method used for pooling this component. Defaults to none.

  • auto_activate (bool) – Whether the component will be automatically activated on creation.

Return type

ParticleSystemComponent

classmethod spawn_force_feedback_at_location(world_context_object, force_feedback_effect, location, rotation=[0.000000, 0.000000, 0.000000], looping=False, intensity_multiplier=1.000000, start_time=0.000000, attenuation_settings=None, auto_destroy=True) ForceFeedbackComponent

Plays a force feedback effect at the given location. This is a fire and forget effect and does not travel with any actor. Replication is also not handled at this point.

Parameters
  • world_context_object (Object) –

  • force_feedback_effect (ForceFeedbackEffect) – effect to play

  • location (Vector) – World position to center the effect at

  • rotation (Rotator) – World rotation to center the effect at

  • looping (bool) –

  • intensity_multiplier (float) – Intensity multiplier

  • start_time (float) – How far in to the feedback effect to begin playback at

  • attenuation_settings (ForceFeedbackAttenuation) – Override attenuation settings package to play effect with

  • auto_destroy (bool) – Whether the returned force feedback component will be automatically cleaned up when the feedback pattern finishes (by completing or stopping) or whether it can be reactivated

Returns

Force Feedback Component to manipulate the playing feedback effect with

Return type

ForceFeedbackComponent

classmethod spawn_force_feedback_attached(force_feedback_effect, attach_to_component, attach_point_name='None', location=[0.000000, 0.000000, 0.000000], rotation=[0.000000, 0.000000, 0.000000], location_type=AttachLocation.KEEP_RELATIVE_OFFSET, stop_when_attached_to_destroyed=False, looping=False, intensity_multiplier=1.000000, start_time=0.000000, attenuation_settings=None, auto_destroy=True) ForceFeedbackComponent

Plays a force feedback effect attached to and following the specified component. This is a fire and forget effect. Replication is also not handled at this point.

Parameters
  • force_feedback_effect (ForceFeedbackEffect) – effect to play

  • attach_to_component (SceneComponent) –

  • attach_point_name (Name) – Optional named point within the AttachComponent to attach to

  • location (Vector) – Depending on the value of Location Type this is either a relative offset from the attach component/point or an absolute world position that will be translated to a relative offset

  • rotation (Rotator) – Depending on the value of Location Type this is either a relative offset from the attach component/point or an absolute world rotation that will be translated to a relative offset

  • location_type (AttachLocation) – Specifies whether Location is a relative offset or an absolute world position

  • stop_when_attached_to_destroyed (bool) – Specifies whether the feedback effect should stop playing when the owner of the attach to component is destroyed.

  • looping (bool) –

  • intensity_multiplier (float) – Intensity multiplier

  • start_time (float) – How far in to the feedback effect to begin playback at

  • attenuation_settings (ForceFeedbackAttenuation) – Override attenuation settings package to play effect with

  • auto_destroy (bool) – Whether the returned force feedback component will be automatically cleaned up when the feedback patern finishes (by completing or stopping) or whether it can be reactivated

Returns

Force Feedback Component to manipulate the playing feedback effect with

Return type

ForceFeedbackComponent

classmethod spawn_sound2d(world_context_object, sound, volume_multiplier=1.000000, pitch_multiplier=1.000000, start_time=0.000000, concurrency_settings=None, persist_across_level_transition=False, auto_destroy=True) AudioComponent

This function allows users to create Audio Components with settings specifically for non-spatialized, non-distance-attenuated sounds. Audio Components created using this function by default will not have Spatialization applied. Sound instances will begin playing upon spawning this Audio Component.

  • Not Replicated.

Parameters
  • world_context_object (Object) –

  • sound (SoundBase) – Sound to play.

  • volume_multiplier (float) – A linear scalar multiplied with the volume, in order to make the sound louder or softer.

  • pitch_multiplier (float) – A linear scalar multiplied with the pitch.

  • start_time (float) – How far in to the sound to begin playback at

  • concurrency_settings (SoundConcurrency) – Override concurrency settings package to play sound with

  • persist_across_level_transition (bool) –

  • auto_destroy (bool) – Whether the returned audio component will be automatically cleaned up when the sound finishes (by completing or stopping) or whether it can be reactivated

Returns

An audio component to manipulate the spawned sound

Return type

AudioComponent

classmethod spawn_sound_at_location(world_context_object, sound, location, rotation=[0.000000, 0.000000, 0.000000], volume_multiplier=1.000000, pitch_multiplier=1.000000, start_time=0.000000, attenuation_settings=None, concurrency_settings=None, auto_destroy=True) AudioComponent

Spawns a sound at the given location. This does not travel with any actor. Replication is also not handled at this point.

Parameters
  • world_context_object (Object) –

  • sound (SoundBase) – sound to play

  • location (Vector) – World position to play sound at

  • rotation (Rotator) – World rotation to play sound at

  • volume_multiplier (float) – A linear scalar multiplied with the volume, in order to make the sound louder or softer.

  • pitch_multiplier (float) – A linear scalar multiplied with the pitch.

  • start_time (float) – How far in to the sound to begin playback at

  • attenuation_settings (SoundAttenuation) – Override attenuation settings package to play sound with

  • concurrency_settings (SoundConcurrency) – Override concurrency settings package to play sound with

  • auto_destroy (bool) – Whether the returned audio component will be automatically cleaned up when the sound finishes (by completing or stopping) or whether it can be reactivated

Returns

An audio component to manipulate the spawned sound

Return type

AudioComponent

classmethod spawn_sound_attached(sound, attach_to_component, attach_point_name='None', location=[0.000000, 0.000000, 0.000000], rotation=[0.000000, 0.000000, 0.000000], location_type=AttachLocation.KEEP_RELATIVE_OFFSET, stop_when_attached_to_destroyed=False, volume_multiplier=1.000000, pitch_multiplier=1.000000, start_time=0.000000, attenuation_settings=None, concurrency_settings=None, auto_destroy=True) AudioComponent

This function allows users to create and play Audio Components attached to a specific Scene Component. Useful for spatialized and/or distance-attenuated sounds that need to follow another object in space.

Parameters
  • sound (SoundBase) – sound to play

  • attach_to_component (SceneComponent) –

  • attach_point_name (Name) – Optional named point within the AttachComponent to play the sound at

  • location (Vector) – Depending on the value of Location Type this is either a relative offset from the attach component/point or an absolute world position that will be translated to a relative offset

  • rotation (Rotator) – Depending on the value of Location Type this is either a relative offset from the attach component/point or an absolute world rotation that will be translated to a relative offset

  • location_type (AttachLocation) – Specifies whether Location is a relative offset or an absolute world position

  • stop_when_attached_to_destroyed (bool) – Specifies whether the sound should stop playing when the owner of the attach to component is destroyed.

  • volume_multiplier (float) – A linear scalar multiplied with the volume, in order to make the sound louder or softer.

  • pitch_multiplier (float) – A linear scalar multiplied with the pitch.

  • start_time (float) – How far in to the sound to begin playback at

  • attenuation_settings (SoundAttenuation) – Override attenuation settings package to play sound with

  • concurrency_settings (SoundConcurrency) – Override concurrency settings package to play sound with

  • auto_destroy (bool) – Whether the returned audio component will be automatically cleaned up when the sound finishes (by completing or stopping) or whether it can be reactivated

Returns

An audio component to manipulate the spawned sound

Return type

AudioComponent

classmethod suggest_projectile_velocity_custom_arc(world_context_object, start_pos, end_pos, override_gravity_z=0.000000, arc_param=0.500000) Vector or None

Returns the launch velocity needed for a projectile at rest at StartPos to land on EndPos. Assumes a medium arc (e.g. 45 deg on level ground). Projectile velocity is variable and unconstrained. Does no tracing.

Parameters
  • world_context_object (Object) –

  • start_pos (Vector) – Start position of the simulation

  • end_pos (Vector) – Desired end location for the simulation

  • override_gravity_z (float) – Optional override of WorldGravityZ

  • arc_param (float) – Change height of arc between 0.0-1.0 where 0.5 is the default medium arc, 0 is up, and 1 is directly toward EndPos.

Returns

out_launch_velocity (Vector): Returns the launch velocity required to reach the EndPos

Return type

Vector or None

classmethod un_retain_all_sounds_in_sound_class(sound_class) None

Iterate through all sound waves and releases handles to retained chunks. (If the chunk is not being played it will be up for eviction)

Parameters

sound_class (SoundClass) –

classmethod unload_stream_level(world_context_object, level_name, latent_info, should_block_on_unload) None

Unload a streamed in level (by Name)

Parameters
classmethod unload_stream_level_by_soft_object_ptr(world_context_object, level, latent_info, should_block_on_unload) None

Unload a streamed in level (by Object Reference)

Parameters