Open 3D Engine AzFramework API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AzFramework::SpawnableEntitiesDefinition Class Referenceabstract

#include <SpawnableEntitiesInterface.h>

Public Member Functions

 AZ_RTTI (AzFramework::SpawnableEntitiesDefinition, "{A9ED3F1F-4D69-4182-B0CD-EB561EEA7068}")
 
virtual void SpawnAllEntities (EntitySpawnTicket &ticket, SpawnAllEntitiesOptionalArgs optionalArgs={})=0
 
virtual void SpawnEntities (EntitySpawnTicket &ticket, AZStd::vector< uint32_t > entityIndices, SpawnEntitiesOptionalArgs optionalArgs={})=0
 
virtual void DespawnAllEntities (EntitySpawnTicket &ticket, DespawnAllEntitiesOptionalArgs optionalArgs={})=0
 
virtual void DespawnEntity (AZ::EntityId entityId, EntitySpawnTicket &ticket, DespawnEntityOptionalArgs optionalArgs={})=0
 
virtual void RetrieveTicket (EntitySpawnTicket::Id ticketId, RetrieveEntitySpawnTicketCallback callback, RetrieveTicketOptionalArgs optionalArgs={})=0
 
virtual void ReloadSpawnable (EntitySpawnTicket &ticket, AZ::Data::Asset< Spawnable > spawnable, ReloadSpawnableOptionalArgs optionalArgs={})=0
 
virtual void UpdateEntityAliasTypes (EntitySpawnTicket &ticket, AZStd::vector< EntityAliasTypeChange > updatedAliases, UpdateEntityAliasTypesOptionalArgs optionalArgs={})=0
 
virtual void ListEntities (EntitySpawnTicket &ticket, ListEntitiesCallback listCallback, ListEntitiesOptionalArgs optionalArgs={})=0
 
virtual void ListIndicesAndEntities (EntitySpawnTicket &ticket, ListIndicesEntitiesCallback listCallback, ListEntitiesOptionalArgs optionalArgs={})=0
 
virtual void ClaimEntities (EntitySpawnTicket &ticket, ClaimEntitiesCallback listCallback, ClaimEntitiesOptionalArgs optionalArgs={})=0
 
virtual void Barrier (EntitySpawnTicket &ticket, BarrierCallback completionCallback, BarrierOptionalArgs optionalArgs={})=0
 
virtual void LoadBarrier (EntitySpawnTicket &ticket, BarrierCallback completionCallback, LoadBarrierOptionalArgs optionalArgs={})=0
 

Protected Member Functions

virtual void * CreateTicket (AZ::Data::Asset< Spawnable > &&spawnable)=0
 
virtual void IncrementTicketReference (void *ticket)=0
 
virtual void DecrementTicketReference (void *ticket)=0
 
virtual EntitySpawnTicket::Id GetTicketId (void *ticket)=0
 
virtual const AZ::Data::Asset< Spawnable > & GetSpawnableOnTicket (void *ticket)=0
 

Static Protected Member Functions

template<typename T >
static T & GetTicketPayload (EntitySpawnTicket &ticket)
 
template<typename T >
static const T & GetTicketPayload (const EntitySpawnTicket &ticket)
 
template<typename T >
static T * GetTicketPayload (EntitySpawnTicket *ticket)
 
template<typename T >
static const T * GetTicketPayload (const EntitySpawnTicket *ticket)
 

Friends

class EntitySpawnTicket
 

Detailed Description

Interface definition to (de)spawn entities from a spawnable into the game world.

While the callbacks of the individual calls are being processed they will block processing any other request. Callbacks can be issued from threads other than the one that issued the call, including the main thread.

Calls on the same ticket are guaranteed to be executed in the order they are issued. Note that when issuing requests from multiple threads on the same ticket the order in which the requests are assigned to the ticket is not guaranteed.

Most calls have a priority with values that range from 0 (highest priority) to 255 (lowest priority). The implementation of this interface may choose to use priority lanes which doesn't guarantee that higher priority requests happen before lower priority requests if they don't pass the priority lane threshold. Priority lanes and their thresholds are implementation specific and may differ between platforms. Note that if a call happened on a ticket with lower priority followed by a one with a higher priority the first lower priority call will still need to complete before the second higher priority call can be executed and the priority of the first call will not be updated.

Member Function Documentation

◆ Barrier()

virtual void AzFramework::SpawnableEntitiesDefinition::Barrier ( EntitySpawnTicket ticket,
BarrierCallback  completionCallback,
BarrierOptionalArgs  optionalArgs = {} 
)
pure virtual

Blocks until all operations made on the provided ticket before the barrier call have completed.

Parameters
ticketThe ticket to monitor.
completionCallbackRequired callback that will be called as soon as the barrier has been reached.
optionalArgsOptional additional arguments, see BarrierOptionalArgs.

◆ ClaimEntities()

virtual void AzFramework::SpawnableEntitiesDefinition::ClaimEntities ( EntitySpawnTicket ticket,
ClaimEntitiesCallback  listCallback,
ClaimEntitiesOptionalArgs  optionalArgs = {} 
)
pure virtual

Claim all entities that are spawned using this ticket. Ownership of the entities is transferred from the ticket to the caller through the callback. After this call the ticket will have no entities associated with it. The caller of this function will need to manage the entities after this call.

Parameters
ticketOnly the entities associated with this ticket will be released.
listCallbackRequired callback that will be called to transfer the entities through.
optionalArgsOptional additional arguments, see ClaimEntitiesOptionalArgs.

◆ DespawnAllEntities()

virtual void AzFramework::SpawnableEntitiesDefinition::DespawnAllEntities ( EntitySpawnTicket ticket,
DespawnAllEntitiesOptionalArgs  optionalArgs = {} 
)
pure virtual

Removes all entities in the provided list from the environment.

Parameters
ticketThe ticket previously used to spawn entities with.
optionalArgsOptional additional arguments, see DespawnAllEntitiesOptionalArgs.

◆ DespawnEntity()

virtual void AzFramework::SpawnableEntitiesDefinition::DespawnEntity ( AZ::EntityId  entityId,
EntitySpawnTicket ticket,
DespawnEntityOptionalArgs  optionalArgs = {} 
)
pure virtual

Removes the entity with the provided id from the spawned list of entities.

Parameters
entityIdthe id of entity to despawn.
ticketThe ticket previously used to spawn entities with.
optionalArgsOptional additional arguments, see DespawnEntityOptionalArgs.

◆ ListEntities()

virtual void AzFramework::SpawnableEntitiesDefinition::ListEntities ( EntitySpawnTicket ticket,
ListEntitiesCallback  listCallback,
ListEntitiesOptionalArgs  optionalArgs = {} 
)
pure virtual

List all entities that are spawned using this ticket.

Parameters
ticketOnly the entities associated with this ticket will be listed.
listCallbackRequired callback that will be called to list the entities on.
optionalArgsOptional additional arguments, see ListEntitiesOptionalArgs.

◆ ListIndicesAndEntities()

virtual void AzFramework::SpawnableEntitiesDefinition::ListIndicesAndEntities ( EntitySpawnTicket ticket,
ListIndicesEntitiesCallback  listCallback,
ListEntitiesOptionalArgs  optionalArgs = {} 
)
pure virtual

List all entities that are spawned using this ticket with their spawnable index. Spawnables contain a flat list of entities, which are used as templates to spawn entities from. For every spawned entity the index of the entity in the spawnable that was used as a template is stored. This version of ListEntities will return both the entities and this index. The index can be used with SpawnEntities to create the same entities again. Note that the same index may appear multiple times as there are no restriction on how many instance of a specific entity can be created.

Parameters
ticketOnly the entities associated with this ticket will be listed.
listCallbackRequired callback that will be called to list the entities and indices on.
optionalArgsOptional additional arguments, see ListEntitiesOptionalArgs.

◆ LoadBarrier()

virtual void AzFramework::SpawnableEntitiesDefinition::LoadBarrier ( EntitySpawnTicket ticket,
BarrierCallback  completionCallback,
LoadBarrierOptionalArgs  optionalArgs = {} 
)
pure virtual

Blocks until the spawnable is loaded and all operations made on the provided ticket before the barrier call have completed.

Parameters
ticketThe ticket to monitor.
completionCallbackRequired callback that will be called as soon as the barrier has been reached.
optionalArgsOptional additional arguments, see BarrierOptionalArgs.

◆ ReloadSpawnable()

virtual void AzFramework::SpawnableEntitiesDefinition::ReloadSpawnable ( EntitySpawnTicket ticket,
AZ::Data::Asset< Spawnable spawnable,
ReloadSpawnableOptionalArgs  optionalArgs = {} 
)
pure virtual

Removes all entities in the provided list from the environment and reconstructs the entities from the provided spawnable.

Parameters
ticketHolds the information on the entities to reload.
priorityThe priority at which this call will be executed.
spawnableThe spawnable that will replace the existing spawnable. Both need to have the same asset id.
optionalArgsOptional additional arguments, see ReloadSpawnableOptionalArgs.

◆ RetrieveTicket()

virtual void AzFramework::SpawnableEntitiesDefinition::RetrieveTicket ( EntitySpawnTicket::Id  ticketId,
RetrieveEntitySpawnTicketCallback  callback,
RetrieveTicketOptionalArgs  optionalArgs = {} 
)
pure virtual

Gets the EntitySpawnTicket associated with the entitySpawnTicketId.

Parameters
entitySpawnTicketIdthe id of EntitySpawnTicket to get.
callbackThe callback to execute upon retrieving the ticket.

◆ SpawnAllEntities()

virtual void AzFramework::SpawnableEntitiesDefinition::SpawnAllEntities ( EntitySpawnTicket ticket,
SpawnAllEntitiesOptionalArgs  optionalArgs = {} 
)
pure virtual

Spawn instances of all entities in the spawnable.

Parameters
ticketStores the results of the call. Use this ticket to spawn additional entities or to despawn them.
optionalArgsOptional additional arguments, see SpawnAllEntitiesOptionalArgs.

◆ SpawnEntities()

virtual void AzFramework::SpawnableEntitiesDefinition::SpawnEntities ( EntitySpawnTicket ticket,
AZStd::vector< uint32_t >  entityIndices,
SpawnEntitiesOptionalArgs  optionalArgs = {} 
)
pure virtual

Spawn instances of some entities in the spawnable.

Parameters
ticketStores the results of the call. Use this ticket to spawn additional entities or to despawn them.
priorityThe priority at which this call will be executed.
entityIndicesThe indices into the template entities stored in the spawnable that will be used to spawn entities from.
optionalArgsOptional additional arguments, see SpawnEntitiesOptionalArgs.

◆ UpdateEntityAliasTypes()

virtual void AzFramework::SpawnableEntitiesDefinition::UpdateEntityAliasTypes ( EntitySpawnTicket ticket,
AZStd::vector< EntityAliasTypeChange updatedAliases,
UpdateEntityAliasTypesOptionalArgs  optionalArgs = {} 
)
pure virtual

Allows updating the entity alias on a spawnable. This allows the spawning behavior for all entities spawned from the used spawnable to be changed and is not restricted to this ticket alone.

Parameters
ticketHolds the information for the spawnable.
updateAliasesAn array of index and alias type values used to update the entity alias list.
optionalArgsOptional additional arguments, see UpdateEntityAliasTypesOptionalArgs.

The documentation for this class was generated from the following file: