Navigation
API > API/Runtime > API/Runtime/AIModule > API/Runtime/AIModule/UAIBlueprintHelperLibrary
Description
Spawns AI agent of a given class. The PawnClass needs to have AIController set for the function to spawn a controller as well.
| Name | SpawnAIFromClass |
| Type | function |
| Header File | /Engine/Source/Runtime/AIModule/Classes/Blueprint/AIBlueprintHelperLibrary.h |
| Include Path | #include "Blueprint/AIBlueprintHelperLibrary.h" |
| Source | /Engine/Source/Runtime/AIModule/Private/Blueprint/AIBlueprintHelperLibrary.cpp |
UFUNCTION (BlueprintCallable, Category="AI",
Meta=(WorldContext="WorldContextObject", UnsafeDuringActorConstruction="true", AdvancedDisplay="Owner"))
static APawn * SpawnAIFromClass
(
UObject * WorldContextObject,
TSubclassOf < APawn > PawnClass,
UBehaviorTree * BehaviorTree,
FVector Location,
FRotator Rotation,
bool bNoCollisionFail,
AActor * Owner
)
Parameters
| Name | Remarks |
|---|---|
| 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). |