UAbilityTask_SpawnActor

Convenience task for spawning actors on the network authority.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

GameplayAbilities

Header

/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Public/Abilities/Tasks/AbilityTask_SpawnActor.h

Include

#include "Abilities/Tasks/AbilityTask_SpawnActor.h"

Syntax

[UCLASS](Programming/UnrealArchitecture/Reference/Classes#classdeclaration)()
class UAbilityTask_SpawnActor : public UAbilityTask

Remarks

Convenience task for spawning actors on the network authority. If not the net authority, we will not spawn and Success will not be called. The nice thing this adds is the ability to modify expose on spawn properties while also implicitly checking network role before spawning.

Though this task doesn't do much - games can implement similiar tasks that carry out game specific rules. For example a 'SpawnProjectile' task that limits the available classes to the games projectile class, and that does game specific stuff on spawn (for example, determining firing position from a weapon attachment - logic that we don't necessarily want in ability blueprints).

Long term we can also use this task as a sync point. If the executing client could wait execution until the server creates and replicate sthe actor down to him. We could potentially also use this to do predictive actor spawning / reconciliation.

Variables

Name Description

Protected variable

FGameplayAbilit...

 

CachedTargetDataHandle

Public variable UProperty BlueprintAssignable

FSpawnActorDele...

 

DidNotSpawn

Called when we can't spawn: on clients or potentially on server if they fail to spawn (rare)

Public variable UProperty BlueprintAssignable

FSpawnActorDele...

 

Success

Constructors

Name Description

Public function

UAbilityTask_SpawnActor

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function UFunction BlueprintCallable, Category, Meta

bool

 

BeginSpawningActor

(
    UGameplayAbility* OwningAbilit...,
    FGameplayAbilityTargetDataHandle Ta...,
    TSubclassOf< AActor > Class,
    AActor*& SpawnedActor
)

Public function UFunction BlueprintCallable, Category, Meta

void

 

FinishSpawningActor

(
    UGameplayAbility* OwningAbilit...,
    FGameplayAbilityTargetDataHandle Ta...,
    AActor* SpawnedActor
)

Public function Static UFunction BlueprintCallable, Category, Meta

UAbilityTask...

 

SpawnActor

(
    UGameplayAbility* OwningAbilit...,
    FGameplayAbilityTargetDataHandle Ta...,
    TSubclassOf< AActor > Class
)

Spawn new Actor on the network authority (server)

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss