Closed jkeon closed 11 months ago
Removing IEntitySpawnDefinitionExtension as it doesn't provide any value any more.
IEntitySpawnDefinitionExtension
When using the IEntitySpawnDefinitionExtension.CreateAndPopulate methods, it would first call SpawnDeferredEntity and then PopulateOnEntity.
IEntitySpawnDefinitionExtension.CreateAndPopulate
SpawnDeferredEntity
PopulateOnEntity
However, SpawnDeferredEntity already calls PopulateOnEntity so we end up calling PopulateOnEntity twice.
Normally for set operations, this is fine but not very performant.
But the danger lies in adding to a dynamic buffer where you will now get two adds instead of one.
Removing the second PopulateOnEntity call is easy enough in CreateAndPopulate but then CreateAndPopulate is just a proxy for SpawnDeferredEntity.
CreateAndPopulate
Instead we can just delete this class and callers can call entitySpawner.SpawnDeferredEntity(definition) directly.
entitySpawner.SpawnDeferredEntity(definition)
Removing
IEntitySpawnDefinitionExtension
as it doesn't provide any value any more.What is the current behaviour?
When using the
IEntitySpawnDefinitionExtension.CreateAndPopulate
methods, it would first callSpawnDeferredEntity
and thenPopulateOnEntity
.However,
SpawnDeferredEntity
already callsPopulateOnEntity
so we end up callingPopulateOnEntity
twice.Normally for set operations, this is fine but not very performant.
But the danger lies in adding to a dynamic buffer where you will now get two adds instead of one.
What is the new behaviour?
Removing the second
PopulateOnEntity
call is easy enough inCreateAndPopulate
but thenCreateAndPopulate
is just a proxy forSpawnDeferredEntity
.Instead we can just delete this class and callers can call
entitySpawner.SpawnDeferredEntity(definition)
directly.What issues does this resolve?
What PRs does this depend on?
Does this introduce a breaking change?
CreateAndPopulate
just useSpawnDeferredEntity
directly.