# script-state-handle

> Talos next · Since next

a behaviour keeps an engine object, such as an entity handle (`ctx.entity`, a `ctx.world.find(...)` result) or a `ctx.controller`, in `ctx.state` (directly or inside a plain object or array), in a host built for networked play (`HostConfig::networked()`, the `warn_module_state` switch); a snapshot keeps `ctx.state` as data, so the object becomes a plain record of its fields and, after a rollback restore or for a late joiner, is no longer live: writes to it move nothing. Found by class (an object the engine registered, never by its shape), when a snapshot is taken: a networked session meets it at its first snapshot after the object is stored (every tick in rollback play); plain data, `Date`, `Map` and a class the script declares are not reported; said once per module and path (list entries fold to `[]`), with the path (`vis`, `deep.a[1].h`), and the behaviour's entity

| | |
|---|---|
| Severity | `warning` |

## Meaning

a behaviour keeps an engine object, such as an entity handle (`ctx.entity`, a `ctx.world.find(...)` result) or a `ctx.controller`, in `ctx.state` (directly or inside a plain object or array), in a host built for networked play (`HostConfig::networked()`, the `warn_module_state` switch); a snapshot keeps `ctx.state` as data, so the object becomes a plain record of its fields and, after a rollback restore or for a late joiner, is no longer live: writes to it move nothing. Found by class (an object the engine registered, never by its shape), when a snapshot is taken: a networked session meets it at its first snapshot after the object is stored (every tick in rollback play); plain data, `Date`, `Map` and a class the script declares are not reported; said once per module and path (list entries fold to `[]`), with the path (`vis`, `deep.a[1].h`), and the behaviour's entity

## Fix

store the entity id (`ctx.entity.id` / `handle.id`) in `ctx.state` and look it up with `ctx.world.find(id)` where you use it
