# Entities: count property

> The count read-only property of the Entities interface is the number of entities in the room.

The **`count`** read-only property of the [`Entities`](/docs/room/entities) interface is the number of entities in the room.

## Value

A whole number: every live entity, of every kind, hidden kinds included. `room.state`, private state and presence entries aren't entities here and aren't counted, unlike on the client.

## Examples

### Refusing to spawn past a budget

```ts
// spawner.ts
import { defineRoom, defineSchema, entity } from "@irtio/room";

const Slime = entity("slime", { x: "f32", y: "f32" });
const MAX_ENTITIES = 500;

export default defineRoom({
  tickRate: 10,
  schema: defineSchema({ entities: [Slime] }),
  onTick(room) {
    if (room.tick % 50 === 0 && room.entities.count < MAX_ENTITIES) {
      room.entities.create(Slime, { x: Math.random() * 100, y: Math.random() * 100 });
    }
  },
});
```

## See also

- [`Entities.all()`](/docs/room/entities/all)
