Skip to content

Instantly share code, notes, and snippets.

@dmitryzenevich
Created September 16, 2024 08:17
Show Gist options
  • Select an option

  • Save dmitryzenevich/5cd79d4dc991ef6a8e6fc42a41cf1449 to your computer and use it in GitHub Desktop.

Select an option

Save dmitryzenevich/5cd79d4dc991ef6a8e6fc42a41cf1449 to your computer and use it in GitHub Desktop.
Entitas buffered entities extension in Unity
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