dots-spawning-patterns

Community

Spawn ECS entities fast, safely, deterministically.

AuthordyCuong03
Version1.0.0
Installs0

System Documentation

What problem does it solve?

It solves slow or incorrect entity spawning in Unity DOTS by showing efficient, deterministic patterns that avoid common performance traps and runtime failures.

Core Features & Use Cases

  • Batched main-thread spawning: Instantiate a prefab Entity in one call, write per-entity data afterward, and manage Allocator.Temp correctly for fast bursts.
  • ECB-based job spawning: Spawn entities from parallel jobs using EntityCommandBuffer.ParallelWriter with [ChunkIndexInQuery], ensuring correct deferred playback.
  • Deterministic randomness: Use Burst-friendly Unity.Mathematics.Random with seeded CreateFromIndex to keep replays and tests consistent.
  • Safety via gating and guardrails: Apply RequireForUpdate<T> to prevent missing singletons, and follow anti-patterns to avoid invalid code paths.

What problem does it solve?

Guidance focuses on implementing spawners for enemy waves, projectile fire, particle-like ECS entities, and any “create N entities per frame (or burst)” systems that must stay performant and replay-stable.

Quick Start

Follow the main-thread or ECB job pattern in the guide to spawn your prefab Entity in batches while using Random.CreateFromIndex with a non-zero deterministic seed.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: dots-spawning-patterns
Download link: https://github.com/dyCuong03/unity-agent-team/archive/main.zip#dots-spawning-patterns

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.