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
Comments (1)
-
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
- Getting a deprecated package for JetBrains Rider pop up when opening or creating a project
- [Android] Volume level of the same audio file is different on Samsung Galaxy Tab A8 between 2023.3.0b3 and 2023.3.0b4
- ‘Expected end of value’ warning occurs when a property declaration includes five or more variable references
- Tags window completely breaks and throws Exception errors when Adding a Tag to a GameObject
- Crash on BurstCompilerService::CompileAsync when entering Play mode in a specific scene
Resolution Note:
NAB. There aren't any guarantees about what entity id will be, other than they will be unique identifiers.