---
title: "Scripting & the Node Lifecycle"
type: concept
tags: [scripting, lifecycle, process, ready, pausing]
updated: 2026-06-19
confidence: high
sources: [raw/web_community-scripting-godot-engine-stable-documentation-in-english.md, raw/web_community-creating-your-first-script-godot-engine-stable-documentation.md, raw/web_community-pausing-games-and-process-mode-godot-engine-stable-documenta.md]
---

# Scripting & the Node Lifecycle

A **script** attached to a [node](nodes-and-scenes.md) gives it behavior by overriding engine callbacks. The script extends the node's type and becomes that node.

## Core lifecycle callbacks

- **`_ready()`** — called once when the node and its children have entered the [scene tree](nodes-and-scenes.md); do setup, cache node references here.
- **`_process(delta)`** — called every rendered frame; `delta` is seconds since last frame. Use for non-physics per-frame logic (UI, timers, input polling). Frame-rate dependent, so scale by `delta`.
- **`_physics_process(delta)`** — called at a fixed rate (default 60 Hz) in sync with the [physics](physics.md) engine; do movement and physics here for deterministic behavior.
- **`_input(event)` / `_unhandled_input(event)`** — receive [input events](input.md).
- **`_enter_tree()` / `_exit_tree()`** — when the node is added/removed from the tree.

## A first script

Attach a script to a node, then in `_process`/`_physics_process` read input and move it; in `_ready` grab references (`@onready var sprite = $Sprite2D`). Build behavior from these callbacks plus [signals](signals.md) for events.

## Pausing & process modes

Setting `get_tree().paused = true` pauses the game. Each node's **process mode** decides how it behaves while paused: `INHERIT` (default), `PAUSABLE` (stops when paused), `ALWAYS` (keeps running — for pause menus), or `DISABLED`. This lets a pause menu stay interactive while gameplay freezes — set the menu's process mode to `ALWAYS`.

## Frame vs physics

Rule of thumb: **movement/physics → `_physics_process`** (fixed timestep, deterministic); **visuals/UI/other → `_process`**. Mixing them up causes jittery or frame-rate-dependent gameplay.
