wave4-ijobentity-advanced-patterns

Implement filtered IJobEntity queries with deterministic ECB sort keys.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you extend ECS simulation jobs using IJobEntity with precise query filtering and deterministic scheduling so production systems behave consistently across frames.

Core Features & Use Cases

  • Query filter attributes: Use [WithAll], [WithNone], [WithAny], [WithDisabled], and [WithPresent] to control exactly which entities your job targets.
  • Deterministic parallel command ordering: Use [ChunkIndexInQuery] when scheduling ECB.ParallelWriter commands to keep structural changes stable.
  • Stable scatter/write indexing: Use [EntityIndexInQuery] when you need a per-entity stable index (e.g., writing into NativeArrays by entity).
  • Production safety guidance: Avoid common anti-patterns (wrong sort key, missing partial, incorrect dependency assignment) that cause subtle runtime bugs.

Quick Start

Ask the AI to refactor an existing IJobEntity job to add the correct With* filters and apply [ChunkIndexInQuery]/[EntityIndexInQuery] so ECB.ParallelWriter ordering and NativeArray indexing become deterministic.

Frequently Asked Questions about wave4-ijobentity-advanced-patterns

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

FAQPage Schema
How do I filter entities in a Unity DOTS IJobEntity job?

To filter entities in an IJobEntity job, apply attribute-based query filters like [WithAll], [WithNone], [WithAny], [WithDisabled], and [WithPresent] directly on the job struct to control exactly which entities are targeted.

Why are my EntityCommandBuffer.ParallelWriter structural changes non-deterministic in Unity DOTS?

Parallel ECB commands become non-deterministic when using incorrect sort keys. You must use the [ChunkIndexInQuery] attribute when scheduling EntityCommandBuffer.ParallelWriter commands to keep structural change ordering stable across frames.

What is the correct way to write per-entity data into a NativeArray using IJobEntity?

Writing per-entity data into a NativeArray requires a stable scatter index. Use the [EntityIndexInQuery] attribute in your IJobEntity execution to ensure stable, entity-indexed scatter writes into the NativeArray.

How do I safely schedule an IJobEntity with structural changes in ECS systems?

To safely schedule an IJobEntity with structural changes, use [ChunkIndexInQuery] for ECB.ParallelWriter sort keys, avoid common anti-patterns like missing partial keywords, and properly assign dependencies to state.Dependency.

When should I use [WithPresent] versus [WithAll] for ECS query filtering?

Use [WithAll] to target entities that must have a specific component enabled, and use [WithPresent] to target entities that have the component present in any state, allowing precise control over query semantics in your IJobEntity job.