The following was changed:
- The remapper in AZ::IdUtils now has an additional argument to tell it what to do when it encounters the same source entity id. The original behavior of ignoring the new entity id and returning the first occurrence is the default. The alternative behavior is to store the last known entity id and return that instead.
- Split the optional arguments for SpawnAllEntities and SpawnEntities.
- SpawnEntities now has an option to continue with the entity mapping from a previous spawn call or to start with a fresh mapping. The latter is the default as the former will come at a performance cost since the mapping table has to be reconstructed.
- Entities spawned using SpawnEntities and ReloadEntities now also get the correct entity mapping applied.
- Added several new unit tests to cover most of the new functionality.
- Fixed some places where the older API version was still called.
This change makes it possible to provide a Serialize Context for spawning entities from spawnables. This also removes the need for the Serialize Context to be retrieved multiple times per frame.
This commit fixes a crash that could happen when a spawnable ticket was deleted before all requests in the queue had completed. Because of this crash the requests now only hold on to the payload of the ticket but not the ticket itself. As a side effect, callbacks can no longer provide the ticket itself so instead a unique id for the ticket is returned.
It's now possible to have high and normal priority calls on the spawnable entities manager. This allows for events like (de)spawning and retrieving information to be executed before already queued requests, though requests cannot be reordered on the same ticket. High priority calls are executed twice per frame, while normal priority calls are called only once.
A new list function was added to the SpawnableEntitiesInterface that list entities together with the id of the entity in the spawnable that was used to create it.
This change also include the setup for testing the SpawnableEntitiesManager plus a few tests to cover the newly added functionality.