Spawning Actors

Spawning an Actor from a Content browser Asset

There are two methods to spawning an actor in our current 3D level: from an unreal class or from an asset.

From an Unreal Class

For Unreal Classes such as a CineCameraActor we can use:

EditorActorSubsystem = unreal.get_editor_subsystem(unreal.EditorActorSubsystem)

actor = EditorActorSubsystem.spawn_actor_from_class(
    unreal.CineCameraActor, 
    unreal.Vector()
)

From a Content browser Asset

For assets such as Blueprints and Static Meshes in the Content browser we can use:

EditorActorSubsystem = unreal.get_editor_subsystem(unreal.EditorActorSubsystem)

asset_path = "/Game/some/asset/path"
asset = unreal.load_asset(asset_path)
actor = EditorActorSubsystem.spawn_actor_from_object(
    asset, 
    unreal.Vector()
)

Default Location

The second parameter on both of these functions is the Location parameter, with additional code you can spawn actors along a path, under the mouse, or in front of the viewport camera as a few examples

Last updated