Created
September 16, 2024 08:17
-
-
Save dmitryzenevich/5cd79d4dc991ef6a8e6fc42a41cf1449 to your computer and use it in GitHub Desktop.
Entitas buffered entities extension in Unity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class Ex | |
| { | |
| public static IEnumerable<TEntity> GetEntitiesBuffered<TEntity>(this IGroup<TEntity> group) where TEntity : class, IEntity | |
| { | |
| using var _ = UnityEngine.Pool.ListPool<TEntity>.Get(out List<TEntity> buffer); | |
| foreach (var entity in group.GetEntities(buffer)) | |
| yield return entity; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment