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
- UxmlNamespacePrefix does not apply when using UIBuilder documents
- UI Builder Data Path Source List starts flickering and scrolling when trying to select the last item in the list
- Crash on ProcessSceneBeforeExport when analyzing selected Addressables rules in a specific project
- HDR images are compressed incorrectly with default settings on Android Platform
- Crash with multiple stack traces when painting detail on Terrain with a highly detailed Prefab
Resolution Note:
NAB. There aren't any guarantees about what entity id will be, other than they will be unique identifiers.