UAIBlueprintHelperLibrary::SpawnAIFromClass

Spawns AI agent of a given class.

Choose your operating system:

Windows

macOS

Linux

References

Module

AIModule

Header

/Engine/Source/Runtime/AIModule/Classes/Blueprint/AIBlueprintHelperLibrary.h

Include

#include "Blueprint/AIBlueprintHelperLibrary.h"

Source

/Engine/Source/Runtime/AIModule/Private/Blueprint/AIBlueprintHelperLibrary.cpp

Syntax

static APawn * SpawnAIFromClass
(
    UObject * WorldContextObject,
    TSubclassOf< APawn > PawnClass,
    UBehaviorTree * BehaviorTree,
    FVector Location,
    FRotator Rotation,
    bool bNoCollisionFail,
    AActor * Owner
)

Remarks

Spawns AI agent of a given class. The PawnClass needs to have AIController set for the function to spawn a controller as well.

Parameters

Parameter

Description

BehaviorTree

if set, and the function has successfully spawned and AI controller, this BehaviorTree asset will be assigned to the AI controller, and run.

Owner

lets you spawn the AI in a sublevel rather than in the persistent level (which is the default behavior).