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
- Light Anchor component has non-zero default values for Elevation when adding a new Light Anchor component
- Inspector elements are rendered twice when the script component is added via drag-and-drop while the HideFlags.HideInInspector property is set
- Error "Light baking failed with error code 5 (Convergence data not available while rendering lightmaps)" thrown in Console when generating lighting for specific GameObjects
- Copy and Paste options for an Animation Property value are disabled in the Right click contextual menu
- Asset is not found when searching the Label "NewLabel" in Search Window
Resolution Note:
NAB. There aren't any guarantees about what entity id will be, other than they will be unique identifiers.