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::SpawnableEntitiesManager::Ticket Struct Referencefinal

Public Member Functions

 AZ_CLASS_ALLOCATOR (Ticket, AZ::ThreadPoolAllocator)
 

Public Attributes

AZStd::atomic_int64_t m_referenceCount { 1 }
 
EntityIdMap m_entityIdReferenceMap
 
AZStd::unordered_set< AZ::EntityId > m_previouslySpawned
 
AZStd::vector< AZ::Entity * > m_spawnedEntities
 
AZStd::vector< uint32_t > m_spawnedEntityIndices
 
AZ::Data::Asset< Spawnablem_spawnable
 
uint32_t m_nextRequestId { 0 }
 Next id to be handed out to command that's using this ticket..
 
uint32_t m_currentRequestId { 0 }
 The id for the command that should be executed.
 
uint32_t m_ticketId { 0 }
 The unique id that identifies this ticket.
 
bool m_loadAll { true }
 

Static Public Attributes

static constexpr uint32_t Processing = AZStd::numeric_limits<uint32_t>::max()
 

Member Data Documentation

◆ m_entityIdReferenceMap

EntityIdMap AzFramework::SpawnableEntitiesManager::Ticket::m_entityIdReferenceMap

Map of prototype entity ids to their associated instance ids. Tickets can be used to spawn the same prototype entities multiple times, in any order, across multiple calls. Since prototype entities can reference other entities, this map is used to fix up those references across calls using the following policy:

  • Entities referencing an entity that hasn't been spawned yet will get a reference to the id that will be used the first time that entity will be spawned. The reference will be invalid until that entity is spawned, but will be valid if/when it gets spawned.
  • Entities referencing an entity that has been spawned will get a reference to the id that was last used to spawn the entity. Note that this implies a certain level of non-determinism when spawning across calls, because the entity references will be based on the order in which the SpawnEntity calls occur, which can be affected by things like priority.

◆ m_previouslySpawned

AZStd::unordered_set<AZ::EntityId> AzFramework::SpawnableEntitiesManager::Ticket::m_previouslySpawned

For this to work, we also need to keep track of whether or not each entity has been spawned at least once, so we know whether or not to replace the id in the map when spawning a new instance of that entity.


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