Skip to content

SceneCounter

namespace Griff.Runtime;
public sealed class SceneCounter

Counts a scene (see SceneCounts) a slice of its entities at a time, so a big one is counted over several goes without holding up a frame: 20,000 entities take about 3.6 ms to count at once in a Debug editor.

public SceneCounts? Count(Scene scene)

Counts the next slice of scene’s entities. Returns its counts once a whole pass is done, otherwise null.

A pass goes through the entities there were as it started: one destroyed since isn’t counted, and one spawned since waits for the next pass. Asking about another scene starts again.

public void Restart(Scene? scene = null)

Forgets the pass so far: the next Count starts a fresh one.

public const int DefaultSlice

About half a millisecond’s counting in a Debug editor.