entity-query-patterns-requireforupdate-gating

Gate Unity DOTS systems with state.RequireForUpdate calls in OnCreate.

6|Updated Apr 2, 2026
One-click install
npx skills add https://github.com/dyCuong03/unity-agent-team --skill entity-query-patterns-requireforupdate-gating
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: entity-query-patterns-requireforupdate-gating
Source: https://github.com/dyCuong03/unity-agent-team/tree/main/.claude/skills/unity-dots/entity-query-patterns-requireforupdate-gating
Command: npx skills add https://github.com/dyCuong03/unity-agent-team --skill entity-query-patterns-requireforupdate-gating

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents first-frame crashes and wasted work in Unity DOTS by ensuring systems only update when their required singletons, feature-flag tags, or prerequisite entity queries are present.

Core Features & Use Cases

  • Senior RequireForUpdate gating: Enforces that every ISystem/SystemBase declares prerequisites in OnCreate so OnUpdate is skipped when the world is not ready.
  • AND semantics across multiple gates: Combines multiple RequireForUpdate calls so the system runs only when all declared conditions are satisfied.
  • Correct query-based prerequisites: Uses state.RequireForUpdate(query) when the requirement is “at least one entity matching complex conditions,” not merely “a singleton exists.”
  • Empty tag feature-flag pattern: Gates feature systems on baked empty component tags derived from authoring toggles, generalizing ExecuteXxx-style patterns.

Quick Start

Use this skill when authoring a new DOTS system so you add state.RequireForUpdate<T>() or state.RequireForUpdate(query) in OnCreate, then verify that toggling feature flags makes the gated systems appear or disappear.

Frequently Asked Questions about entity-query-patterns-requireforupdate-gating

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent Unity DOTS systems from crashing on the first frame when singletons are missing?

Prevent Unity DOTS first-frame crashes by declaring state.RequireForUpdate<T>() in OnCreate to gate systems, ensuring OnUpdate is skipped until required singletons or feature-flag tags exist in the world.

What is the difference between RequireForUpdate and runtime early-returns in ECS?

RequireForUpdate gating moves prerequisite checks to OnCreate using state.RequireForUpdate<T>() or state.RequireForUpdate(query), preventing scheduler overhead by skipping OnUpdate entirely, unlike runtime early-returns which still execute the system.

How do I gate Unity DOTS systems on multiple conditions using RequireForUpdate?

Gate Unity DOTS systems on multiple conditions by calling state.RequireForUpdate<T>() multiple times in OnCreate, which applies AND semantics so the system only runs when all declared gates are satisfied.

When should I use RequireForUpdate with an entity query instead of a singleton type?

Use state.RequireForUpdate(query) when the prerequisite is at least one entity matching complex conditions, rather than state.RequireForUpdate<T>() which only checks if a singleton component exists.

Can I use RequireForUpdate gating for feature flags in Unity DOTS subscene baking?

Yes, you can gate feature systems in Unity DOTS subscene baking by using RequireForUpdate to check for baked empty component tags derived from authoring toggles, generalizing ExecuteXxx-style patterns.

Why is my Unity DOTS system running before the subscene baking is complete?

Unity DOTS systems run before baking completes when missing prerequisites are not gated using state.RequireForUpdate<T>() in OnCreate, causing first-frame race conditions when required entities or tags are absent.