Navigation
API > API/Plugins > API/Plugins/GameplayAbilities
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 replicates the actor down to it. We could potentially also use this to do predictive actor spawning / reconciliation.
| Name | UAbilityTask_SpawnActor |
| Type | class |
| Header File | /Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Public/Abilities/Tasks/AbilityTask_SpawnActor.h |
| Include Path | #include "Abilities/Tasks/AbilityTask_SpawnActor.h" |
Syntax
UCLASS (MinimalAPI)
class UAbilityTask_SpawnActor : public UAbilityTask
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UGameplayTask → UAbilityTask → UAbilityTask_SpawnActor
Implements Interfaces
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UAbilityTask_SpawnActor
(
const FObjectInitializer& ObjectInitializer |
Abilities/Tasks/AbilityTask_SpawnActor.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| DidNotSpawn | FSpawnActorDelegate | Called when we can't spawn: on clients or potentially on server if they fail to spawn (rare) | Abilities/Tasks/AbilityTask_SpawnActor.h |
|
| Success | FSpawnActorDelegate | Abilities/Tasks/AbilityTask_SpawnActor.h |
|
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool BeginSpawningActor
(
UGameplayAbility* OwningAbility, |
Abilities/Tasks/AbilityTask_SpawnActor.h |
|
|
void FinishSpawningActor
(
UGameplayAbility* OwningAbility, |
Abilities/Tasks/AbilityTask_SpawnActor.h |
|
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static UAbilityTask_SpawnActor * SpawnActor
(
UGameplayAbility* OwningAbility, |
Spawn new Actor on the network authority (server) | Abilities/Tasks/AbilityTask_SpawnActor.h |
|