Skip to content

ComponentList<T>

namespace Griff.Scenes;
public struct ComponentList<T>

The components of one type in a scene, as they were when asked for (see All), in hierarchy order: entities depth first, and each entity’s in the order they’re attached. Spawning, destroying or adding components while going through it is safe; it doesn’t change. Going through it with foreach allocates nothing.

public int Count { get; }
public T? this[int index] { get; }
public ReadOnlySpan<T> AsSpan()
public T? FirstOrDefault()

The first of them, or null if there are none.

public ComponentList<T>.Enumerator GetEnumerator()