Skip to content
mouse114514 edited this page Sep 12, 2026 · 1 revision

On Every Frame

On Every Frame

Overview

Triggers every game tick (~60 times per second). Use it for logic that must update continuously: monitoring player state, applying ongoing effects, or changing values over time. Because it fires so often, keep only lightweight blocks inside.

This is a hat block: it must be placed at the top of a script.

Slots

This block has no parameter slots.

Connections

Connection Type Description
Top - hat block, cannot connect
Bottom Statement connected blocks run once per frame

Typical Uses

  • Monitor player health, hunger or temperature each frame and react when below a threshold
  • Ongoing regen/damage, poison or stress accumulation effects
  • Cyclic "swaying" logic

Performance Notes

Roughly 60 executions per second. Avoid:

  • heavy math or deep loops
  • spawning/destroying objects frequently
  • complex string operations

Example

on every frame
├── if player hunger < 20 then
│   └── talk "I'm starving!"
└── if player temperature > 39 then
    └── set pain to player pain + 0.1

Generated Code

Emits the patch marker //PATCH:Update, injected into the Update() method.

Block ID: cu_when_update


中文 | Event Blocks | Block Reference

Clone this wiki locally