# RealtimeScene

Class · extends `Events` · category: Internal

Source: https://github.com/playcanvas/editor-api/blob/4303c34bcee9a418297350899ad3a3f555526ec4/src/realtime/scene.ts#L12

Represents a scene in sharedb

## Constructors

### constructor

```ts
new RealtimeScene(uniqueId: number, realtime: Realtime, connection: RealtimeConnection)
```

Constructor

**Parameters**

- `uniqueId` (`number`): The unique scene id
- `realtime` ([`Realtime`](https://api.playcanvas.com/editor/classes/Realtime.md)): The realtime API
- `connection` ([`RealtimeConnection`](https://api.playcanvas.com/editor/classes/RealtimeConnection.md)): The realtime connection

## Accessors

### data

```ts
get data(): any
```

The scene data

### id

```ts
get id(): number
```

The scene id - used in combination with the branch id

### loaded

```ts
get loaded(): boolean
```

Whether the scene is loaded

### uniqueId

```ts
get uniqueId(): number
```

The scene's unique id

## Methods

### addEntity

```ts
addEntity(entity: Entity): void
```

Add entity to scene

**Parameters**

- `entity` ([`Entity`](https://api.playcanvas.com/editor/classes/Entity.md)): The entity

### load

```ts
load(): void
```

Loads scene from sharedb and subscribes to changes.

### removeEntity

```ts
removeEntity(entity: Entity): void
```

Removes entity from scene (not from children of another entity)

**Parameters**

- `entity` ([`Entity`](https://api.playcanvas.com/editor/classes/Entity.md)): The entity

### submitOp

```ts
submitOp(op: object): void
```

Submits sharedb operation

**Parameters**

- `op` (`object`): The operation

### unload

```ts
unload(): void
```

Unloads scene from sharedb and unsubscribes from changes.

### whenNothingPending

```ts
whenNothingPending(callback: Function): void
```

Calls the callback when there are no changes pending to be
sent to the server

**Parameters**

- `callback` (`Function`): The callback
