There is no efficient way to spawn multiple entities from a single IEntitySpawnDefinition. This is common practice for entities that generate other entities as a side effect, own proxy entities, or who's components have been split up for performance reasons.
The solution for this may not add to IEntitySpawnDefinition but instead create another type that wraps/groups many definitions to a higher concept actor/instance.
For now, a workaround has been implemented as part of (#193) that allows a definition to be created within the PopulateOnEntity method of another definition. This workaround gets the job done but isn't as efficient as instantiating from archtype.
Maybe the proper solution is to provide a mechanism to fetch archetypes for a given definition as needed. That's really the only piece missing here. If this is the direction we take consider whether all definitions should be instantiated through the IEntitySpawnDefinitionExtension.CreateAndPopulate<T>() method.
There is no efficient way to spawn multiple entities from a single
IEntitySpawnDefinition
. This is common practice for entities that generate other entities as a side effect, own proxy entities, or who's components have been split up for performance reasons.The solution for this may not add to
IEntitySpawnDefinition
but instead create another type that wraps/groups many definitions to a higher concept actor/instance.For now, a workaround has been implemented as part of (#193) that allows a definition to be created within the
PopulateOnEntity
method of another definition. This workaround gets the job done but isn't as efficient as instantiating from archtype.Maybe the proper solution is to provide a mechanism to fetch archetypes for a given definition as needed. That's really the only piece missing here. If this is the direction we take consider whether all definitions should be instantiated through the
IEntitySpawnDefinitionExtension.CreateAndPopulate<T>()
method.