decline-cookies / anvil-unity-dots

Unity DOTS and ECS specific additions and extensions to Anvil
MIT License
4 stars 1 forks source link

Add IEntitySpawnDefinitionExtension.CreateAndPopulate() #193

Closed mbaker3 closed 1 year ago

mbaker3 commented 1 year ago

Add a mechanism to create and populate an IEntitySpawnDefinitionExtension on an EntityCommandBuffer when the Archetype from EntitySpawnSystem is not available.

This is a temporary workaround until #192 is resolved.

What is the current behaviour?

If an IEntitySpawnDefinitionExtension needs to spawn multiple entities as part of its creation there is no simple way to leverage other IEntitySpawnDefinitionExtension instances to help with the creation.

What is the new behaviour?

IEntitySpawnDefinitionExtension can now have CreateAndPopulate<T>() called on them to create and populate an entity from the definition and return the entity created so the parent definition may store a reference to the entity.

What issues does this resolve?

What PRs does this depend on?

Does this introduce a breaking change?