Documentation
    Preparing search index...

    Function liveMaterialCount

    • How many materials have been constructed and not yet disposed (§83).

      Every family member (UnlitMaterial, LitMaterial, SpriteMaterial, StandardMaterial, NodeMaterial, and any subclass of Material) counts as one: they all go through the base constructor and Material.dispose.

      const before = liveMaterialCount();
      const material = new UnlitMaterial();
      liveMaterialCount() - before; // 1
      material.dispose();
      liveMaterialCount(); // === before

      Reading it allocates nothing and costs one property read. A material that is collected without dispose() is never subtracted — that is the leak signal, not an oversight.

      Returns number