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
- After converting a Built-in project to URP render texture related errors are spammed that can lead to Game view being rendered on top of Scene view
- UI Builder slider value lags and stutters when sliding/modifying certain property values
- "Reset UI Builder Layout" functionality inconsistently changes Canva Size when "Match Game View" is enabled/disabled
- Texture Import Warnings are obscured by other Terrain Layer options in the Inspector
- Burst Inspector middle divider is jittering when resized with the Burst Inspector window docked
Resolution Note:
NAB. There aren't any guarantees about what entity id will be, other than they will be unique identifiers.