job-dependency-chain

Chain Unity ECS JobHandles through state.Dependency for correct read/write ordering.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents data races and non-deterministic behavior by ensuring every scheduled Unity ECS job participates in the correct dependency chain through state.Dependency.

Core Features & Use Cases

  • Automatic read/write ordering: Enforces correct sequencing between systems by wiring scheduled JobHandles into the ECS scheduler via state.Dependency.
  • Reliable job chaining: Supports both parallel and sequential job patterns by passing state.Dependency into each Schedule/ScheduleParallel call and assigning the returned handle back.
  • Controlled synchronization: Limits state.Dependency.Complete() to only the cases where main-thread results are required in the same frame.

Use case: When you schedule multiple IJobEntity or IJobChunk jobs across one system (e.g., a Prepare job then a Consume job), this Skill ensures Consume runs only after Prepare finishes and that downstream systems observe the correct completion dependency.

Quick Start

Update every job schedule call in your OnUpdate to accept the current state.Dependency and assign the returned JobHandle back to state.Dependency.

Frequently Asked Questions about job-dependency-chain

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

FAQPage Schema
How do I chain Unity ECS job dependencies safely for each frame?

To chain Unity ECS job dependencies safely, pass the current state.Dependency into each Schedule or ScheduleParallel call and assign the returned JobHandle back to state.Dependency. This ensures correct read/write ordering across all systems.

Why do I get race conditions when scheduling multiple IJobEntity jobs in one system?

Race conditions occur when scheduled IJobEntity jobs are not properly chained. Wiring each job's returned JobHandle into state.Dependency enforces correct sequencing, ensuring downstream jobs like Consume wait for Prepare to finish.

When should I call state.Dependency.Complete() in Unity ECS?

Call state.Dependency.Complete() only when main-thread access to job results is required within the same frame. Limiting synchronization prevents unnecessary stalls while maintaining safe read/write ordering for scheduled jobs.

Does this automatic job chaining approach work for both IJobChunk and IJobEntity schedules?

Yes, this approach applies to every IJobEntity and IJobChunk Schedule and ScheduleParallel call within OnUpdate. It reliably handles both parallel and sequential job patterns across all Unity ECS systems.

What is the best way to prevent non-deterministic behavior in Unity DOTS scheduled jobs?

The best way to prevent non-deterministic behavior is to ensure every scheduled Unity ECS job participates in the correct dependency chain through state.Dependency. This enforces strict read/write ordering and prevents data races.