Skip to content

Commit

Permalink
Improve logic when getting unique entities.
Browse files Browse the repository at this point in the history
  • Loading branch information
isadorasophia committed Dec 9, 2024
1 parent 8a5a252 commit b4404a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Bang/World.cs
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ public Entity GetUniqueEntity<T>(int index) where T : struct, IComponent
}
}

Entity? e = context.Entities.LastOrDefault();
Entity? e = context.Entities.FirstOrDefault(e => !e.IsDestroyed);
return e is null || e.IsDestroyed ? null : e;
}

Expand Down

0 comments on commit b4404a3

Please sign in to comment.