Search Issue Tracker
By Design
Votes
0
Found in [Package]
0.0.12-preview.33
Issue ID
1163747
Regression
No
Destroying all entities in a world does not set next empty entity to index 0
How to reproduce:
1. Open attached project "DestroyAllEntities (2).zip"
2. In Package Manager, install Entities package
3. Enter Play mode and observe Console window
Expected result: "Unexpected first entity index for empty world, Entity = 0:2", the new entity's index is 0
Actual result: "Unexpected first entity index for empty world, Entity = 994:2" the new entity's index is 994
Reproducible with: 2019.1.0b7 (preview.30), 2019.1.9f1 (preview.33), 2019.2.0b7 (preview.33),
Could not test with: 2017.4, 2018.4.3f1 (preview.24), 2019.1.0b6 (preview.30) due to package errors
2019.3.0a1 (preview.33), 2019.3.0a7 (preview.33) due to Burst package errors
-
DerekKelly
Jul 05, 2019 19:09
That would be fair enough.
But calling MoveEntitiesFrom on an EntityManager will return the next entity id to 0.
So will calling DestroyEntity on all the Entities in the world in reverse order.
As will this
NativeArray<Entity> entityArray = testWorld.EntityManager.GetAllEntities();
List<Entity> entityList = new List<Entity>(entityArray.Reverse());
entityArray.CopyFrom(entityList.ToArray());
testWorld.EntityManager.DestroyEntity(entityArray);It would be nice to get this behaviour without jumping through hoops. A Reset method perhaps.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- [UIBuilder] Changes aren't detected on types implementing IList
- [HDRP] Text is rendered with artefacts when using STP and resolution scale is set a float value
- [Settings Search] Search results not matching search term correctly
- Crash on memcpy when opening a project that loads TSS files
- Multiple errors appear when compiling a ShaderGraph shader's code in a specific project
Resolution Note:
NAB. There aren't any guarantees about what entity id will be, other than they will be unique identifiers.